mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 09:56:12 +02:00
SynEdit: search replace: Optimizations
git-svn-id: trunk@47507 -
This commit is contained in:
parent
928215038f
commit
e8cc11e5cf
@ -880,13 +880,18 @@ begin
|
|||||||
x:=EndPos.X-SearchLen-1
|
x:=EndPos.X-SearchLen-1
|
||||||
else
|
else
|
||||||
x:=StartPos.X-1;
|
x:=StartPos.X-1;
|
||||||
|
if IsMultiLinePattern then begin
|
||||||
|
if FBackwards then
|
||||||
|
x:=Min(x, 0) // keep negative to indicate pattern does not fit into line
|
||||||
|
else
|
||||||
|
x:=Max(x, LineLen-SearchLen) // keep higher x, if pattern does not fit
|
||||||
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
if FBackwards then
|
if FBackwards xor IsMultiLinePattern then
|
||||||
x:=LineLen-SearchLen
|
x:=LineLen-SearchLen
|
||||||
else
|
else
|
||||||
x:=0;
|
x:=0;
|
||||||
end;
|
end;
|
||||||
x:=MinMax(x,0,LineLen-1);
|
|
||||||
//DebugLn(['TSynEditSearch.FindNextOne Line="',LineStr,'" x=',x,' LineLen=',LineLen]);
|
//DebugLn(['TSynEditSearch.FindNextOne Line="',LineStr,'" x=',x,' LineLen=',LineLen]);
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
@ -904,7 +909,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
FoundEndPos:=FoundStartPos;
|
FoundEndPos:=FoundStartPos;
|
||||||
if CheckFound then exit(true);
|
if CheckFound then exit(true);
|
||||||
end else begin
|
end else
|
||||||
|
if (x >= 0) and (x+SearchLen <= LineLen) then // otherwise searchterm does not fit in this line
|
||||||
|
begin
|
||||||
//DebugLn(['TSynEditSearch.FindNextOne x=',x,' MaxPos=',MaxPos,' Line="',Line,'"']);
|
//DebugLn(['TSynEditSearch.FindNextOne x=',x,' MaxPos=',MaxPos,' Line="',Line,'"']);
|
||||||
while (x>=0) and (x<=MaxPos) do begin
|
while (x>=0) and (x<=MaxPos) do begin
|
||||||
//DebugLn(['TSynEditSearch.FindNextOne x=',x]);
|
//DebugLn(['TSynEditSearch.FindNextOne x=',x]);
|
||||||
@ -956,11 +963,11 @@ begin
|
|||||||
if ASupportUnicodeCase and (not fSensitive) then LineStr := UTF8LowerCase(LineStr);
|
if ASupportUnicodeCase and (not fSensitive) then LineStr := UTF8LowerCase(LineStr);
|
||||||
LineLen:=length(LineStr);
|
LineLen:=length(LineStr);
|
||||||
Line:=PChar(LineStr);
|
Line:=PChar(LineStr);
|
||||||
if FBackwards then
|
// IsMultiLinePattern must be at other end of line (continues in next/prev line)
|
||||||
|
if FBackwards xor IsMultiLinePattern then
|
||||||
x:=LineLen-SearchLen
|
x:=LineLen-SearchLen
|
||||||
else
|
else
|
||||||
x:=0;
|
x:=0;
|
||||||
x:=MinMax(x,0,LineLen-1);
|
|
||||||
//DebugLn(['TSynEditSearch.FindNextOne Line="',LineStr,'" x=',x,' LineLen=',LineLen]);
|
//DebugLn(['TSynEditSearch.FindNextOne Line="',LineStr,'" x=',x,' LineLen=',LineLen]);
|
||||||
until (y<MinY) or (y>MaxY);
|
until (y<MinY) or (y>MaxY);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user