Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Caret updates incorrectly
Caret updates incorrectly [message #54042] Thu, 29 May 2003 11:30
Eclipse UserFriend
Originally posted by: tim.duckdogmedia.com

I've been working on a plug-in for some time now, and I'm almost finished,
but I'm running into one quirky situation with the editor that I'm
creating. The problem is that when I replace text within the editor and
the text that I'm replacing exists on a line different than where the
caret resides, the caret shifts it's position if the replacement text
differs in length from the original text. In my editor I have certain
"headers" to delineate sections of text; i.e.

~~~A Testing Section~~~
test something

~~~An Adding Section~~~
add something

~~~A Delete Section~~~
delete something

...so in my case if I type something in one of the sections that doesn't
fit in that section, let's say I change the add to a delete in the Adding
Section, i.e.

~~~A Testing Section~~~
test something

~~~An Adding Section~~~
delete something

~~~A Delete Section~~~
delete something

...then I need to change the header for the Adding Section; i.e.

~~~A Testing Section~~~
test something

~~~A Delete Section~~~
delete something

~~~A Delete Section~~~
delete something

...all of that works except when I detect the change my caret would be
right after the word delete before I modified the header; i.e.

~~~A Testing Section~~~
test something

~~~An Adding Section~~~
delete<--Caret is right there! something

~~~A Delete Section~~~
delete something

...as soon as I change the header the caret winds up shifting over the
number of characters different in the new header than in the old; i.e.

~~~A Testing Section~~~
test something

~~~A Delete Section~~~
delete <--Caret is now here! something

~~~A Delete Section~~~
delete something

...if the new header has fewer characters then the caret shifts over to
the right, if more character shifts to the left.

Does anyone know how I can prevent this from happening?

Thanks,

Tim
Previous Topic:Printing line numbers
Next Topic:Problem with markers
Goto Forum:
  


Current Time: Wed May 14 02:09:35 EDT 2025

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

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

Back to the top