added automatic ssoSelectedOnly if selection contains several lines

git-svn-id: trunk@8931 -
This commit is contained in:
mattias 2006-03-13 00:43:03 +00:00
parent 5e2fc8584f
commit a2d20ac958

View File

@ -1030,10 +1030,11 @@ begin
FindReplaceDlg.Top:=ATop; FindReplaceDlg.Top:=ATop;
try try
bSelectedTextOption := (ssoSelectedOnly in FindReplaceDlg.Options); bSelectedTextOption := (ssoSelectedOnly in FindReplaceDlg.Options);
//if there are selected text and more than 1 word, automatically enable selected text option //if there are selected text and more than 1 word, automatically enable selected text option
if (EditorComponent.SelAvail and (Pos(' ', EditorComponent.SelText) <> 0)) then if EditorComponent.SelAvail
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly]; and (EditorComponent.BlockBegin.Y<>EditorComponent.BlockEnd.Y) then
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly];
if (FindReplaceDlg.ShowModal = mrCancel) then begin if (FindReplaceDlg.ShowModal = mrCancel) then begin
exit; exit;
@ -1046,10 +1047,11 @@ begin
InputHistories.Save; InputHistories.Save;
DoFindAndReplace; DoFindAndReplace;
finally finally
//Restore original find options //Restore original find options
if bSelectedTextOption then if bSelectedTextOption then
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly] else FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly]
FindReplaceDlg.Options := FindReplaceDlg.Options - [ssoSelectedOnly]; else
FindReplaceDlg.Options := FindReplaceDlg.Options - [ssoSelectedOnly];
end;//End try-finally end;//End try-finally
end; end;
@ -3128,9 +3130,9 @@ begin
if CurCompletionControl=nil then exit; if CurCompletionControl=nil then exit;
if (System.Pos(Key,CurCompletionControl.EndOfTokenChr)>0) then begin if (System.Pos(Key,CurCompletionControl.EndOfTokenChr)>0) then begin
// identifier completed // identifier completed
debugln('TSourceNotebook.OnSynCompletionKeyPress A'); //debugln('TSourceNotebook.OnSynCompletionKeyPress A');
CurCompletionControl.TheForm.OnValidate(Sender,Key,[]); CurCompletionControl.TheForm.OnValidate(Sender,Key,[]);
debugln('TSourceNotebook.OnSynCompletionKeyPress B'); //debugln('TSourceNotebook.OnSynCompletionKeyPress B');
Key:=#0; Key:=#0;
end; end;
end; end;
@ -3142,9 +3144,9 @@ begin
if (length(UTF8Key)=1) if (length(UTF8Key)=1)
and (System.Pos(UTF8Key[1],CurCompletionControl.EndOfTokenChr)>0) then begin and (System.Pos(UTF8Key[1],CurCompletionControl.EndOfTokenChr)>0) then begin
// identifier completed // identifier completed
debugln('TSourceNotebook.OnSynCompletionUTF8KeyPress A'); //debugln('TSourceNotebook.OnSynCompletionUTF8KeyPress A');
CurCompletionControl.TheForm.OnValidate(Sender,UTF8Key,[]); CurCompletionControl.TheForm.OnValidate(Sender,UTF8Key,[]);
debugln('TSourceNotebook.OnSynCompletionKeyPress B'); //debugln('TSourceNotebook.OnSynCompletionKeyPress B');
UTF8Key:=''; UTF8Key:='';
end else begin end else begin
aCompletion.Editor.CommandProcessor(ecChar,UTF8Key,nil); aCompletion.Editor.CommandProcessor(ecChar,UTF8Key,nil);