A text editor will paint itself using something like TextOut (or any other similar API).
It will in most cases only have to repaint small bits of its window. So it must be able to paint any such sub-area. Though canvases have clipping, which means you can paint a bit more sometimes (e.g. you wouldn't try to paint half a char-glyph).
This is painted on the canvas, wich is normally persistent as long as it is visible on the screen. E.g. scrolling can often move the existing visible area on the screen, and fill in only the new text.
So far so good and really simple.
But even with monospaced fonts you have chars of different width. And must handle that. And you must handle text representation in unicode (even with utf16 or utf32) - assuming you will display more than just ASCII a..z, 0..9.
There are for example combining codepoints.
Tabs, you need to expand yourself...
And there is LTR and RTL text. That needs to be rendered properly. Well if you always output entire lines, and don't need line wrapping, then the OS likely will do that for you.
You need to at least have the concept of a text cursor and implement that.
And then likely moving that cursor, and modifying the text buffer.
All in all there will be a lot of tasks that you will need to master to write a text editor.
On the other hand, its a nice challenge, and you can learn a lot doing it. If you have time and commitment.
There are several open source text editors
TSynEdit
ATSynEdit (google)
likely some rich text editor, iirc.