[Lazarus] syncro mode[Re: Auto indentation]

Martin lazarus at mfriebe.de
Wed Nov 4 01:27:20 CET 2009


Further thought about auto indent (for paste) and syncro/template mode.

The only reliable position is the final caret pos (based on that you can 
do indent on return)

- the line-range will be too big.
- the inital caret position will be unusable. because the if any cell 
was above the caret pos, then the text will have moved downwards, while 
the initial caretpos would still be on top


syncro and template edit are created in Sourceeditor around line 2565. 
They are owned and destroyed by synedit (however synedit only knows they 
are plugins, and has no idea what they do)

SourceEditor could keep a reference to the syncro and template module.

Both of them have an Active property. If it is true, you should not 
indent-on-paste

-------
The alternative is to have an "OnBeforePaste" event, and modify the text 
to be pasted, *before* synedit inserts it
(or keep the to-be-pasted text, and act backwards on the final caret pos)

Martin


Martin wrote:
> Mattias Gärtner wrote:
>>
>> Hmm.
>> Apparently synedit's line range is unreliable to find out what was 
>> inserted or what lines have changed.
>> I will ask Martin.
>>
> It should be better now.
>
> I tested for return and various paste events
>
> Martin





More information about the Lazarus mailing list