mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 10:59:30 +02:00
implemented canceling incremental search on other actions
git-svn-id: trunk@6856 -
This commit is contained in:
parent
f213496cfa
commit
8a54770d56
@ -321,7 +321,7 @@ type
|
|||||||
TOnInitIdentCompletion = procedure(Sender: TObject;
|
TOnInitIdentCompletion = procedure(Sender: TObject;
|
||||||
var Handled, Abort: boolean) of object;
|
var Handled, Abort: boolean) of object;
|
||||||
|
|
||||||
TSourceNotebookState = (snIncrementalFind);
|
TSourceNotebookState = (snIncrementalFind, snIncrementalSearching);
|
||||||
TSourceNotebookStates = set of TSourceNotebookState;
|
TSourceNotebookStates = set of TSourceNotebookState;
|
||||||
|
|
||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
@ -384,8 +384,9 @@ type
|
|||||||
fAutoFocusLock: integer;
|
fAutoFocusLock: integer;
|
||||||
FCodeTemplateModul: TSynEditAutoComplete;
|
FCodeTemplateModul: TSynEditAutoComplete;
|
||||||
fCustomPopupMenuItems: TList;
|
fCustomPopupMenuItems: TList;
|
||||||
fIncrementalSearchStartPos: TPoint;
|
FIncrementalSearchPos: TPoint; // last set position
|
||||||
fIncrementalSearchCancelPos: TPoint;
|
fIncrementalSearchStartPos: TPoint; // position where to start searching
|
||||||
|
fIncrementalSearchCancelPos: TPoint;// position where to jump on cancel
|
||||||
FIncrementalSearchStr: string;
|
FIncrementalSearchStr: string;
|
||||||
FKeyStrokes: TSynEditKeyStrokes;
|
FKeyStrokes: TSynEditKeyStrokes;
|
||||||
FLastCodeBuffer: TCodeBuffer;
|
FLastCodeBuffer: TCodeBuffer;
|
||||||
@ -3555,6 +3556,7 @@ begin
|
|||||||
Include(States,snIncrementalFind);
|
Include(States,snIncrementalFind);
|
||||||
fIncrementalSearchStartPos:=TempEditor.EditorComponent.LogicalCaretXY;
|
fIncrementalSearchStartPos:=TempEditor.EditorComponent.LogicalCaretXY;
|
||||||
fIncrementalSearchCancelPos:=fIncrementalSearchStartPos;
|
fIncrementalSearchCancelPos:=fIncrementalSearchStartPos;
|
||||||
|
FIncrementalSearchPos:=fIncrementalSearchStartPos;
|
||||||
IncrementalSearchStr:='';
|
IncrementalSearchStr:='';
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
end;
|
end;
|
||||||
@ -4262,15 +4264,28 @@ var
|
|||||||
PanelCharMode: string;
|
PanelCharMode: string;
|
||||||
PanelXY: string;
|
PanelXY: string;
|
||||||
PanelFileMode: string;
|
PanelFileMode: string;
|
||||||
|
CurEditor: TSynEdit;
|
||||||
begin
|
begin
|
||||||
if not Visible then exit;
|
if not Visible then exit;
|
||||||
TempEditor := GetActiveSE;
|
TempEditor := GetActiveSE;
|
||||||
if TempEditor = nil then Exit;
|
if TempEditor = nil then Exit;
|
||||||
if (TempEditor.EditorComponent.CaretY<>TempEditor.ErrorLine)
|
CurEditor:=TempEditor.EditorComponent;
|
||||||
or (TempEditor.EditorComponent.CaretX<>TempEditor.fErrorColumn) then
|
|
||||||
|
if (snIncrementalFind in States)
|
||||||
|
and (CompareCaret(CurEditor.LogicalCaretXY,FIncrementalSearchPos)<>0) then
|
||||||
|
begin
|
||||||
|
// some action has changed the cursor during incremental search
|
||||||
|
// -> end incremental search
|
||||||
|
EndIncrementalFind;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (CurEditor.CaretY<>TempEditor.ErrorLine)
|
||||||
|
or (CurEditor.CaretX<>TempEditor.fErrorColumn) then
|
||||||
TempEditor.ErrorLine:=-1;
|
TempEditor.ErrorLine:=-1;
|
||||||
|
|
||||||
Statusbar.BeginUpdate;
|
Statusbar.BeginUpdate;
|
||||||
|
|
||||||
if snIncrementalFind in States then begin
|
if snIncrementalFind in States then begin
|
||||||
Statusbar.SimplePanel:=true;
|
Statusbar.SimplePanel:=true;
|
||||||
Statusbar.SimpleText:=Format(lisUESearching, [IncrementalSearchStr]);
|
Statusbar.SimpleText:=Format(lisUESearching, [IncrementalSearchStr]);
|
||||||
@ -4657,6 +4672,7 @@ var
|
|||||||
CurEdit: TSynEdit;
|
CurEdit: TSynEdit;
|
||||||
begin
|
begin
|
||||||
if snIncrementalFind in States then begin
|
if snIncrementalFind in States then begin
|
||||||
|
Include(States,snIncrementalSearching);
|
||||||
// search string
|
// search string
|
||||||
CurEdit:=GetActiveSE.EditorComponent;
|
CurEdit:=GetActiveSE.EditorComponent;
|
||||||
CurEdit.BeginUpdate;
|
CurEdit.BeginUpdate;
|
||||||
@ -4672,7 +4688,9 @@ begin
|
|||||||
CurEdit.BlockBegin:=CurEdit.LogicalCaretXY;
|
CurEdit.BlockBegin:=CurEdit.LogicalCaretXY;
|
||||||
CurEdit.BlockEnd:=CurEdit.BlockBegin;
|
CurEdit.BlockEnd:=CurEdit.BlockBegin;
|
||||||
end;
|
end;
|
||||||
|
FIncrementalSearchPos:=CurEdit.LogicalCaretXY;
|
||||||
CurEdit.EndUpdate;
|
CurEdit.EndUpdate;
|
||||||
|
Exclude(States,snIncrementalSearching);
|
||||||
end;
|
end;
|
||||||
UpdateStatusBar;
|
UpdateStatusBar;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user