mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 14:47:21 +01:00
SynEdit: Optimization for same-word highlighter
git-svn-id: trunk@39547 -
This commit is contained in:
parent
65f8b4e839
commit
d610f90bf7
@ -411,9 +411,38 @@ end;
|
||||
procedure TSynEditMarkupHighlightAll.FindStartPoint;
|
||||
var
|
||||
ptStart, ptEnd, ptFoundStart, ptFoundEnd: TPoint;
|
||||
i, j: Integer;
|
||||
begin
|
||||
if fSearchString = '' then exit;
|
||||
|
||||
if (ssoWholeWord in fSearchOptions) and (not HideSingleMatch) then begin
|
||||
// can not wrap around lines
|
||||
fStartPoint := Point(1, TopLine);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (fSearchOptions * [ssoRegExpr, ssoRegExprMultiLine] = []) and
|
||||
(not HideSingleMatch)
|
||||
then begin
|
||||
// can not wrap around lines
|
||||
j := 0;
|
||||
i := Length(fSearchString);
|
||||
while i > 0 do begin
|
||||
if fSearchString[i] = #13 then begin
|
||||
inc(j);
|
||||
if (i > 1) and (fSearchString[i-1] = #10) then dec(i); // skip alternating
|
||||
end
|
||||
else
|
||||
if fSearchString[i] = #10 then begin
|
||||
inc(j);
|
||||
if (i > 1) and (fSearchString[i-1] = #13) then dec(i); // skip alternating
|
||||
end;
|
||||
dec(i);
|
||||
end;
|
||||
fStartPoint := Point(1, Max(1, TopLine - j));
|
||||
exit;
|
||||
end;
|
||||
|
||||
FindInitialize(true);
|
||||
ptStart := Point(1, Max(1, TopLine-100));
|
||||
ptEnd.Y := TopLine;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user