[Lazarus] Displaying text with colour and insertion point

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed May 16 19:37:16 CEST 2012


Martin wrote:
> On 16/05/2012 16:32, Mark Morgan Lloyd wrote:
>>
>> Since it's emulating a mechanical terminal that printed to roll paper, 
>> the number of lines is indeterminate and increasing. I suppose that I 
>> could limit it to (say) 1000, but if other people started using it 
>> there'd be bound to be somebody complain.
>>
> 
> I see.

Same also applies to any onscreen display of scrolling status etc., 
except that it doesn't have the same insertion-point requirement.

> Still possible (at least I think)
> 
> Highlighter stores something called a range for each line (line as in 
> textbuffer lines, so scrolling of display does not matter)
> They are automatically adjusted if lines are added/inserted/removed 
> from/to the textbuffer
> 
> So you could write a HL, that stores a list of x-positions for each 
> line, together with the attributes. (If you edit the line itself, you 
> need to adjust the list)
> The highlighter can then return the text, cut into "tokens" (in your 
> case each continuous group of chars with the same attributes), and 
> supply the attributes for each token.
> 
> By default the "Range" is not freed, when the line is dropped (e.g. if 
> it is an enum or set, then just the memory is dropped).
> But the highlighter allows to override that code, so it can be added.
> 
> Depends how interested you are.
> I can assist, and help put together the framework, but you'll have to 
> implement the rest.

It sounds like a lot of work, shoehorning something which isn't really 
its forte into Synedit.

Before anything more, I'll drop a note to Cmdline's author (if he's not 
in here already) and see if he's got any suggestions.

Otherwise, can anybody say whether are there any stringgrid derivatives 
etc. that will do this?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list