Subversion Repositories fastphp

Compare Revisions

Regard whitespace Rev 66 → Rev 67

/trunk/FindReplace.pas
51,7 → 51,7
procedure OnFind(Sender: TObject); virtual;
procedure OnReplace(Sender: TObject); virtual;
 
procedure DoFind(dialog: TFindDialog; direction: TFindDirection);
procedure DoFind(dialog: TFindDialog; direction: TFindDirection); overload;
procedure DoReplace(dialog: TReplaceDialog; direction: TFindDirection);
 
function GetDirection(dialog: TFindDialog): TFindDirection;
139,6 → 139,7
 
if not found then
begin
// TODO: If single replace was chosen, behave like Notepad and select the last replaced word
if direction = sdForwards then
MessageDlg('End of document reached.', mtInformation, [mbOk], 0)
else
153,6 → 154,7
opt: TSynSearchOptions;
numReplacements: integer;
begin
try
if direction = sdDefault then direction := GetDirection(dialog);
 
opt := [];
165,6 → 167,15
if fEditor.SelAvail then Include(opt, ssoSelectedOnly);
Exclude(opt, ssoEntireScope); // TODO: ok?
 
if not (ssoReplaceAll in opt) then
begin
if fEditor.SelLength = 0 then
begin
DoFind(dialog, sdForwards);
exit;
end;
end;
 
fEditor.BeginUpdate; // TODO: geht nicht?
//fEditor.BeginUndoBlock;
try
174,10 → 185,18
fEditor.EndUpdate;
end;
 
if not (ssoReplaceAll in opt) then
begin
DoFind(dialog, sdForwards);
end
else
begin
ShowMessageFmt('%d replaced.', [numReplacements]);
 
end;
finally
if fAutofocus and fEditor.CanFocus then fEditor.SetFocus;
end;
end;
 
procedure TSynEditFindReplace.OnFind(Sender: TObject);
begin