To keep track of positions within an editor, you can use marks (type
Mark.htmlMark).
Essentially, you can put a mark
into an editor at a specified position (with createMark), and
query its position later (getBaseIndex). The gravity of the
mark specifies wether when text is inserted at the exact position of
the text, it should move to the left, or the right.
There's more you can do with an editor. For one, you can also insert
widgets into the text (this is called an embedded window), with
the function
so you can have buttons, entries, and even another editor inside an
editor (see the module EmbeddedTextWin.htmlEmbeddedTextWin).
Further, you can search the text inside an editor (with the search function), read and write the contents to and from a file, scroll the contents to a specific position, and much more as found in the module Editor.htmlEditor.