Lazarus

Programming => Packages and Libraries => SynEdit => Topic started by: BubikolRamios on July 18, 2022, 02:22:54 am

Title: SynEdit MarkupManager RemoveMarkUp MarkupByClass
Post by: BubikolRamios on July 18, 2022, 02:22:54 am
Why is this looping indefinitely ? Does not go to exception.
I guess It should remove type of TSynEditMarkupHighlightAll until none is left ?

assuming
Code: Pascal  [Select][+][-]
  1. MarkupManager.MarkupByClass[TSynEditMarkupHighlightAll]
  2.  
returns only one of n there.

How to do that ?



Code: Pascal  [Select][+][-]
  1.   while 1 = 1 do
  2.   begin
  3.   try
  4.  
  5.    SynEdit1.MarkupManager.RemoveMarkUp(SynEdit1.MarkupManager.MarkupByClass[TSynEditMarkupHighlightAll]);
  6.    except
  7.     on E: Exception do
  8.     begin
  9.      showmessage('foo');
  10.     end;
  11.    end;
  12.   end;      
  13.  
Title: Re: SynEdit MarkupManager RemoveMarkUp MarkupByClass
Post by: Martin_fr on July 18, 2022, 11:28:19 am
Why is this looping indefinitely ? Does not go to exception.

Why should it?
I haven't verified that, but I guess MarkupByClass eventually returns nil, and RemoveMarkup does nothing.

If so, you can check yourself if the value is nil.


You are aware, that once you done that, you must ensure not to call SynEdit.SetHighlightSearch (or related).
They have a pointer (dangling pointer, after you removed it) to the markup.
TinyPortal © 2005-2018