The Craft of Text Editing¹ should be required reading for everybody who wants to write a new text editor.
Or Theory and practice of text editors, or, A cookbook for an Emacs, the original thesis written by Craig A. Finseth in 1980 before he wrote the book I originally linked to: <https://dspace.mit.edu/handle/1721.1/15905>