Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Preserving text editor caret position
Preserving text editor caret position [message #202600] Thu, 18 October 2007 08:25
Martin Vlk is currently offline Martin Vlk
Messages: 55
Registered: July 2009
Member
Hi All,
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.

Ideas appreciated.
Cheers
Martin
Previous Topic:How to: Convert a org.apache.xerces.dom Node to org.eclipse.wst.html.core.internal.document Node
Next Topic:.properties not loaded from WEB-INF/classes
Goto Forum:
  


Current Time: Fri Aug 01 10:17:02 EDT 2014

Powered by FUDForum. Page generated in 0.01652 seconds