[Lazarus] SynEdit.TextBetweenPoints (Martin?)

Bart bartjunk64 at gmail.com
Sun Aug 11 13:21:27 CEST 2019


On Sun, Aug 11, 2019 at 12:46 AM Martin Frb via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

> This should be all you need. Caret, Selection and IsBackwardSel are all kept
>
...
>      SetTextBetweenPoints(BB, BB, Pre, [setMoveBlock], scamAdjust,
> smaMoveUp, smNormal);
>    // scamAdjust => Move the caret with the block.
>      BE := BlockEnd;
>      SetTextBetweenPoints(BE, BE, Post, [setMoveBlock], scamIgnore,
> smaMoveUp, smNormal);
>    // setMoveBlock for the 2nd call,  is to KEEP the selection as it is.
> So to keep caret => scamIgnore

Yes, this seems to work OK, even when Lines.Count = 0.

So, now I need to $ifdef my workaround for Lazarus 2.0.
What ifdef to use?

> Also  SelEnd / SelStart are really slow (they have to iterate over all
> lines up to the selection, each time you call them. SynEdit operates
> with x/y locations.

I know, see the diff in
https://sourceforge.net/p/flyingsheep/code/324/tree//trunk/EPlus/editorpagecontrol.pp?diff=4faa6364b9363c207f000850:323

+  //Using SetTextBetweenPoints is faster (and according to Martin
Friebe) more reliable
+  //than using SelStart and SelLength (like the old code did)

That code was by you, so you got me into this mess in the first place :-)

-- 
Bart


More information about the lazarus mailing list