[Lazarus] LineRange [Re: Auto indentation]

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Nov 3 20:55:08 CET 2009


On Tue, 03 Nov 2009 17:46:48 +0000
Martin <lazarus at mfriebe.de> wrote:

> Mattias Gärtner wrote:
> > Zitat von Martin <lazarus at mfriebe.de>:
> >
> >> Mattias,
> >>
> >> have you looked at using
> >>  StartLine := Min(Old:ogCaret.Y, LogCaret.Y);
> >>  EndLine := Max(Old:ogCaret.Y, LogCaret.Y);
> >
> > Sometimes synedit gives me too many lines, sometimes not enough. I 
> > need the real insert range.
> Even if you use the info from the caret?

For example: 

inserting one line:
OldCaret=(x=1,y=47) NewCaret=(x=1,y=48) FirstLinePos=47 LastLinePos=48

replacing one line with one line
OldCaret=(x=1,y=48) NewCaret=(x=1,y=48) FirstLinePos=46 LastLinePos=48

replacing one line with one line
OldCaret=(x=1,y=47) NewCaret=(x=1,y=48) FirstLinePos=46 LastLinePos=48


> Yes, I looked at the FirstLinePos, LastLinePos range => it is wrong 
> sometimes. But the caret seems to be ok for all I have seen.
> 
> Also, as I wrote before: FirstLinePos, LastLinePos is not usable for 
> you, because in syncro-mode it will report more lines than you need
> (and that is by design).

Yes.
How to find out if synedit is in syncro mode?

 
> In syncro mode, you can press enter inside a cell, and the cell 
> willbecome multi-line => indenting in this case must be limited to
> the cell which was active,
> -FirstLinePos, LastLinePos will include the range for *all* cells =>
> if you indent every line in that range, the syncro module, will keep 
> copying every change you make accross all cells => total chaos.
> - the caret will give you the correct range

How?


Mattias




More information about the Lazarus mailing list