dont include backtick if search result is also highlighted

This commit is contained in:
Basile Burg 2021-10-08 16:02:10 +02:00
parent 957ca1321a
commit 95f9babd0c
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,9 @@
# v3.9.13-dev
## Enhancements
- messages, search results: exclude backticks if the option _backTicksHighlight_ is enabled.
# v3.9.12 # v3.9.12
## Enhancement ## Enhancement

View File

@ -638,6 +638,7 @@ var
s: string; s: string;
p: boolean = false; p: boolean = false;
c: array [boolean] of TColor; c: array [boolean] of TColor;
y: boolean;
begin begin
rc := node.DisplayRect(false); rc := node.DisplayRect(false);
x := rc.Left + 2 - TTreeHack(list).ScrolledLeft; x := rc.Left + 2 - TTreeHack(list).ScrolledLeft;
@ -655,6 +656,7 @@ begin
node.ImageIndex, Node.NodeEffect); node.ImageIndex, Node.NodeEffect);
x += list.Images.Width + 5; x += list.Images.Width + 5;
y := fCtxt = amcSearch;
if not fOptions.backticksHighlight then if not fOptions.backticksHighlight then
Sender.Canvas.TextOut(x, rc.Top, Node.Text) Sender.Canvas.TextOut(x, rc.Top, Node.Text)
else if node.Text.isNotEmpty then else if node.Text.isNotEmpty then
@ -669,6 +671,7 @@ begin
s := t.yield(); s := t.yield();
Sender.Canvas.font.Color:= c[p]; Sender.Canvas.font.Color:= c[p];
Sender.Canvas.TextOut(x, rc.Top, s); Sender.Canvas.TextOut(x, rc.Top, s);
x += sender.Canvas.TextWidth(s); x += sender.Canvas.TextWidth(s);
// possibly highlighted part // possibly highlighted part
@ -684,6 +687,8 @@ begin
r.popFront(); r.popFront();
end; end;
s += t.yield(); s += t.yield();
if y and (s.length > 2) then
s := s[2 .. s.length-1];
Sender.Canvas.font.Color:= c[p]; Sender.Canvas.font.Color:= c[p];
Sender.Canvas.TextOut(x, rc.Top, s); Sender.Canvas.TextOut(x, rc.Top, s);
x += sender.Canvas.TextWidth(s); x += sender.Canvas.TextWidth(s);