Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Preserving text editor caret position
Preserving text editor caret position [message #202600] Thu, 18 October 2007 12:25
Martin Vlk is currently offline Martin VlkFriend
Messages: 55
Registered: July 2009
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.
Previous Topic:How to: Convert a org.apache.xerces.dom Node to org.eclipse.wst.html.core.internal.document Node
Next not loaded from WEB-INF/classes
Goto Forum:

Current Time: Mon Aug 15 10:58:55 GMT 2022

Powered by FUDForum. Page generated in 0.02289 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top