Recent

Author Topic: TSynMultiSyn. How use 2 highlighters ?  (Read 3810 times)

TonnyB

  • Newbie
  • Posts: 6
TSynMultiSyn. How use 2 highlighters ?
« on: January 22, 2017, 10:36:21 pm »
Hello there. I try to use 2 highlighters with TSynMultiSyn:
 - TSynAnySyn (add to key words: "boolean" and "integer")
 - TSynPasSyn

It works separately without TSynMultiSyn.

Who can help me:
1. How to configure TSynMultiSyn correctly ?
2. How to configure TSynMultiSyn at runtime ?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: TSynMultiSyn. How use 2 highlighters ?
« Reply #1 on: January 23, 2017, 04:18:15 am »
before going into detail

SynMultiSyn is for cases where you have in your text
Code: Pascal  [Select][+][-]
  1.  tag1  text highlighted by highlighter 1 ONLY endtag1
  2.  tag2  text highlighted by highlighter 2 ONLY endtag2
  3.  
Each portion of text is done by just one highlighter (eg html, css, js)

You want to use TSynAnySyn

SO I assume your text will be all pascal, and you want additional words highlighted, but with the pas highlight continuing.

Look at unit SynEditMarkupHighAll
class TSynEditMarkupHighlightAll
or class TSynEditMarkupHighlightAllMulti

It is not avail in the designer, you must add by code.

x := TSynEditMarkupHighlightAll.create;
synedit.markupmanager.add(x);

no need to free, it is freed with synedit.

i := TSynEditMarkupHighlightAllMulti.AddSeachTerm
TSynEditMarkupHighlightAllMulti.Terms.MatchWordBounds
and similar

for differnt colors, use multiple instances.


TonnyB

  • Newbie
  • Posts: 6
Re: TSynMultiSyn. How use 2 highlighters ?
« Reply #2 on: January 23, 2017, 06:52:39 pm »
Thanks

 

TinyPortal © 2005-2018