TAdvMemo and URL highlight bug (again)

Found another (relatively minor) issue. Looks like the URL parser is not stopping at the double quote... and the link doesn't work when you click on it because it tries to go to:

https://css-tricks.com/snippets/css/css-grid-starter-layouts/%22.---
when it should go to
https://css-tricks.com/snippets/css/css-grid-starter-layouts/

Please see screenshot.



Found another bug. The URL parsing and highlighting algorithm in TAdvMemo seems very unreliable.

It seems the URL is totally missed if the line is wrapped and one of the wrapped segments/lines ends in "https:/". Resizing TAdvMemo so the line segment doesn't end in "https:/" seems to make the URL be recognized, highlighted, and made clickable correctly. See screenshot.

TAdvMemo_URLParseBug2

The text in the memo is (for copy and paste in case it's helpful):

The "forced-colors" media feature is a new Media Queries Level 5 media feature. This media feature is not currently supported by any browser. Visit https://caniuse.com/#search=forced-colors for more information. Note: Browsers should ignore media queries that contain one or more unknown media features. This message is displayed only once.

1 message for line 9

Hmmmm... this forum does strange formatting stuff...

I have tested this here with the code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  advmemo1.Lines.Text := 'The "forced-colors" media feature is a new Media Queries Level 5 media feature. '+
    'This media feature is not currently supported by any browser. Visit https://caniuse.com/#search=forced-colors for more information.'+
    ' Note: Browsers should ignore media queries that contain one or more unknown media features. This message is displayed only once.   ';
  advmemo1.WordWrap := wwClientWidth;
end;

image

I see the same correct result when pasting this text in TAdvMemo

Hi Bruno,

Please try resizing (by making slightly smaller in width) the TAdvMemo so the 4th "line segment" ends in "https:/" instead of "https://". Does it still work?

@brunofierens

Hi Holger, thank you for the animation. You can clearly see the issue there as the URL is recognized then it's not, depending on how the lines are wrapped.

We traced & solved this issue.
We will release an update with this fix this week.

1 Like