On 06/02/2017 11:42, Michael Schnell via Lazarus wrote:
Hi SynEdit Experts,

Doing a special kind of text editor (that in fact needs to feature an invisible signature for each word in the text):

Is it possible to do a highlighter that results in hiding the character sequences found by the highlighting criterion (in fact on screen replaces it by a blank) ?

Not a highlighter, no.

But it may (not sure) be possible writing your custom wrapper to the textbuffer.
look at other sub classes to   TSynEditStringsLinked
Also look at TLazSynDisplayViewEx


Look in SynEditFoldedView
TLazSynDisplayFold is a TLazSynDisplayViewEx that visually adds the [...] at the end of a fold line.


So TLazSynDisplayViewEx is the place to modify the text.
If your TSynEditStringsLinked is up high enough in the chain (included before (search for) FTheLinesView ) then most parts of synedit will see this as the actual text.

The TLazSynDisplayFold is included after FTheLinesView , so for display only (FDisplayView)

-------------
You also must intercept all the Edit* methods in TSynEditStringsLinked . If the editor specifies an x pos, you must map it to the x pos with the invisible included and vice versa, also if the editor acts on a selection you may have to map the length too.

Note some functions (like matching bracket highlight) require that the Highlighter itself delivers tokens for the visible part only (you can filter them in TLazSynDisplayViewEx , but that is for painting only)

Of course if your highlighter does filter them, maybe you do not need TLazSynDisplayViewEx You do need to intercept all the Edit* calls. (And watch id new ones get added in future)



Is there a way to wrap the (visible) text to a predefined line length (using the usual line breaks as paragraph indicator) ?
not yet
again, all the elements from above will be involved.

the tricky bit is to create a map between real line num and wrapped line num.
this must be fast for
- lookup in both direction
- insert/remove/change of rows
A normal array may not be efficient enough. (it may be for you, but not to include for everyone)


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to