|Preserving text editor caret position [message #202600]
||Thu, 18 October 2007 12:25
| Martin Vlk
Registered: July 2009
I am writing some code that checks the document text when the user
starts typing in the editor. If certain condition is satisfied it makes
some modifications to the document and stops checking.
The problem I get is that after the programmatic modification is
finished the caret is left at position different from where the user
started typing. The caret stays at the same line number, but the text
has been rolled down.
What would be the way to somehow remember the caret position so that
after the programmatic modifications are done the caret stays at the
same "logical" position. "Logical" meaning that when a new line is added
before the caret position the caret is moved down to stay at the same
line of text, rather than keeping the line number which of course
contains a different text after the modification.
Powered by FUDForum
. Page generated in 0.01679 seconds