[Lazarus] SynEdit and gutter behaviour

Bart bartjunk64 at gmail.com
Wed Sep 14 23:27:41 CEST 2011


On 9/14/11, Martin <lazarus at mfriebe.de> wrote:
> 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

OK, I get that.

> Since it is of course not desired to select text only to change it,

I really do not understand what you mean by that.
Changing selected text is one of the key features I'm using this app for.

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

The whole purpose of this excercise is the following.

In the SynEdit I load a textfile (html in this case) with Lines.LoadfromFile().
Now after loading I want to see if there is a line which contains a
html meta-tag defining the charset, something like:

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

In that line I want to change the ISO-8859-1 part into something else.

So my strategy was to loop through the lines, see if any line has the
meta-tag I seek, then change the line.
That part I have in working order.

At this stage in the process I do not know at what "Point" this text
is (the caret certainly is not there, so I can't use that as a
reference).

Also, considering when I do this (changing Lines[]), I do not mind
that all prvious "undo" will stop working.

So, now I see 2 options:
1: Calculate the two points defining the text I want to change and use
TextBetweenPoints() or
2: Signal to the gutter that the given line has changed

I really have no idea how to achieve any of those 2 options ATM.

Bart




More information about the Lazarus mailing list