Recent

Author Topic: TSynEditMarkupHighlightAllMulti / multiline  (Read 350 times)

BubikolRamios

  • Full Member
  • ***
  • Posts: 240
TSynEditMarkupHighlightAllMulti / multiline
« on: July 13, 2022, 09:41:25 am »
suppose I have this in synedit, i.e. multiline:
Quote
abc abc
abc

Code: Pascal  [Select][+][-]
  1. var
  2.   YourMarkup:TSynEditMarkupHighlightAllMulti;        
  3. begin
  4.   YourMarkup := TSynEditMarkupHighlightAllMulti.create(SynEdit1);
  5.   SynEdit1.MarkupManager.AddMarkUp(YourMarkup);    
  6.   YourMarkup.AddSearchTerm('abc abcabc');
  7.  

Should paint entire text (my desire), does not.

Any suggestion how to get painted all, maybe changing TSynEditMarkupHighlightAllMulti to something else ?

tested (does not work):
Code: Pascal  [Select][+][-]
  1. YourMarkup.AddSearchTerm('abc abc' + chr(13) + chr(10) + 'abc');    
  2.  



lazarus-2.0.12-fpc-3.2.0-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8260
  • Debugger - SynEdit - and more
    • wiki
Re: TSynEditMarkupHighlightAllMulti / multiline
« Reply #1 on: July 13, 2022, 11:06:58 am »
The TSynEditMarkupHighlightAllMulti does not support multi-line.

afaik only the TSynEditMarkupHighlightAll does. (But it accepts only one search term)

BubikolRamios

  • Full Member
  • ***
  • Posts: 240
Re: TSynEditMarkupHighlightAllMulti / multiline
« Reply #2 on: July 13, 2022, 04:57:08 pm »
hmm, should that work ? it does not.
Code: Pascal  [Select][+][-]
  1. var
  2.   YourMarkup:TSynEditMarkupHighlightAll;
  3.   options: TSynSearchOptions;
  4. begin  
  5.  
  6.  
  7.   YourMarkup := TSynEditMarkupHighlightAll.create(SynEdit1);
  8.  
  9.   SynEdit..MarkupManager.AddMarkUp(YourMarkup);
  10.  
  11.   YourMarkup.SearchString:='foo';
  12.   YourMarkup.MarkupInfo.Background := ATStringProc_HtmlColor.SHtmlColorToColor('#fff000');
  13.   YourMarkup.MarkupInfo.Foreground := clBlack;
  14.   YourMarkup.MarkupInfo.Style := [fsUnderline];
  15.  
  16.   options := [];
  17.   Include(options,ssoRegExprMultiLine);
  18.   Include(options,ssoFindContinue);
  19.   YourMarkup.SearchOptions := options;
  20.  
  21.  
lazarus-2.0.12-fpc-3.2.0-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8260
  • Debugger - SynEdit - and more
    • wiki
Re: TSynEditMarkupHighlightAllMulti / multiline
« Reply #3 on: July 13, 2022, 05:15:18 pm »
A reg-exp does not ignore line breaks.
It matches them with \r and \n.

I haven't tested, but something like
Code: Pascal  [Select][+][-]
  1. YourMarkup.SearchString:='f[\r\n]*o[\r\n]*o';

BubikolRamios

  • Full Member
  • ***
  • Posts: 240
Re: TSynEditMarkupHighlightAllMulti / multiline
« Reply #4 on: July 14, 2022, 03:13:37 am »
for some reason \r\n does not work i.e. no coloring at all

Quote
f
o

This has same/some effect, but coloring is strange
Code: Pascal  [Select][+][-]
  1. YourMarkup.SearchString:='f'+ sLineBreak + 'o';
  2. YourMarkup.SearchString:='f'+ #13#10 + 'o';
  3.  

Will open new thread, as I'm going to drop idea of built in highlighters.
« Last Edit: July 14, 2022, 03:22:39 am by BubikolRamios »
lazarus-2.0.12-fpc-3.2.0-win32/win64

BubikolRamios

  • Full Member
  • ***
  • Posts: 240
Re: TSynEditMarkupHighlightAllMulti / multiline
« Reply #5 on: July 14, 2022, 03:21:43 am »
a note, from edit pad pro
lazarus-2.0.12-fpc-3.2.0-win32/win64

 

TinyPortal © 2005-2018