[Lazarus] SynEdit and gutter behaviour

Martin lazarus at mfriebe.de
Wed Sep 14 16:49:15 CEST 2011


On 14/09/2011 15:43, Bart wrote:
> Hi,
>
> I have a SynEdit on a form and I do this
>
>    SynEdit1.SelText := '//Bye';
>
> This works as expected, and in the gutter the line is now marked as changed.
>
> However if I do this:
>
>    SynEdit1.Lines[1] := SynEdit1.Lines[1] + ' // Hi';
>
> The Line gets updated allright, but the gutter does not mark the line
> as changed.
>
> Question:
>
> 1: Is this a bug?
> 2: If it is not a bug, how can I make the gutter mark this line as changed?
>

this is intended behaviour.

Using SynEdit.Lines, does not trigger any "line change", also it does 
not add "undo" (and previous undo will stop working)
Lines are used for initialization


Since it is of course not desired to select text only to change it, 
there is
SynEdit.TextBetweenPoints[Point(1,200), Point(20,200)]

which can be set to
SynEdit.TextBetweenPoints[Point(1,200), Point(20,200)] := 'foo';

to insert text, use identical points

there is
SynEdit.TextBetweenPointsEx

which has an extra param, to determine, if the caret should be moved (if 
it was behind the location, and text changed (eg, lines inserted)






More information about the Lazarus mailing list