[Lazarus] caret on codetools renames [Re: Last-minute 0.9.28 nominations]

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Sep 26 01:06:43 CEST 2009


On Fri, 25 Sep 2009 23:53:16 +0100
Martin <lazarus at mfriebe.de> wrote:

> Maxim Ganetsky wrote:
> > One more candidate:
> >
> > 4) http://bugs.freepascal.org/view.php?id=12344 (Renaming a
> > component will change the editor line number)
> >    This issue is not major but rather annoying.
> >
> 
> There are pro and contra to this one:
> 
> - pro: one issue less
> - pro: TextBetweenPoints will not be released, and changed to a
> slightly changed implementation in the next release
> 
> - contra: the fix affects everything that uses "OnCodeBufferChanged" 
> (plus possible anything I have overlooked, even though I don't think
> I did) OnCodeBufferChanged is used for *any* change that is
> originated by codetools (except for identifier completion).
> This includes the renaming, and insertions of components. Also the 
> insertions of units into uses. For those three it is correct not to
> move the caret (or keep it in the text).
> I don't know if there are any other changes originating through 
> OnCodeBufferChanged, and if any of them need the caret to move
> (havent found any yet) => if there are, they are broken now.
> 
> If Mattias can confirm that OnCodeBufferChanged can always and safely 
> keep the caret where it is, then maybe ok, but otherwise....
> (Codetooljumps, such as jump to error location are done elsewhere and 
> not affected)

Yes. 
That means if a line is inserted and the caret is behind then the caret
is moved accordingly. The caret should never move to the insert
position.
Some codetools functions make suggestions for new Caret, but it is up to
the calling function to apply it.

Mattias




More information about the Lazarus mailing list