[Lazarus] LineRange [Re: Auto indentation]
Martin
lazarus at mfriebe.de
Tue Nov 3 18:46:48 CET 2009
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?
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).
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
>
>
>> That would also have the advantage that an "end" would be unindented
>> correctly. e.g typing
>>
>> if a > 1 then begin
>> b:= 1; // the indenter has added 2 spaces => correct
>> end;|
>>
>> now hit return at "|".
>> The line with the end in it does not change, so it is not in the
>> range. But it is in the caret range. And it should be unindented
>
> Correcting the leaving line is a todo and planned from the beginning.
use the caret-info and it should already happen
> Another one is a better indenting for breaking long
> expressions/statements.
> But first I want to find a better solution for the indent on paste.
>
> Mattias
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
More information about the Lazarus
mailing list