SynEdit: search/replace, use undo-group if replace all with no user prompt

git-svn-id: trunk@39809 -
This commit is contained in:
martin 2013-01-08 20:01:23 +00:00
parent 25305c11d4
commit fa3535fa07

View File

@ -7150,6 +7150,7 @@ begin
fTSearch.Backwards:=bBackward; fTSearch.Backwards:=bBackward;
// search while the current search position is inside of the search range // search while the current search position is inside of the search range
IncPaintLock; IncPaintLock;
BeginUndoBlock;
try try
ptFoundStartSel.y := -1; ptFoundStartSel.y := -1;
//DebugLn(['TCustomSynEdit.SearchReplace ptStart=',dbgs(ptStart),' ptEnd=',dbgs(ptEnd),' ASearch="',dbgstr(ASearch),'" AReplace="',dbgstr(AReplace),'"']); //DebugLn(['TCustomSynEdit.SearchReplace ptStart=',dbgs(ptStart),' ptEnd=',dbgs(ptEnd),' ASearch="',dbgstr(ASearch),'" AReplace="',dbgstr(AReplace),'"']);
@ -7179,11 +7180,13 @@ begin
SetFoundCaretAndSel; SetFoundCaretAndSel;
EnsureCursorPosVisible; EnsureCursorPosVisible;
try try
EndUndoBlock;
DecPaintLock; DecPaintLock;
nAction := DoOnReplaceText(ASearch,CurReplace, nAction := DoOnReplaceText(ASearch,CurReplace,
ptFoundStart.Y,ptFoundStart.X); ptFoundStart.Y,ptFoundStart.X);
finally finally
IncPaintLock; IncPaintLock;
BeginUndoBlock
end; end;
if nAction = raCancel then exit; if nAction = raCancel then exit;
end else end else
@ -7227,6 +7230,7 @@ begin
end; end;
finally finally
SetFoundCaretAndSel; SetFoundCaretAndSel;
EndUndoBlock;
DecPaintLock; DecPaintLock;
end; end;
end; end;