mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 13:38:08 +02:00
Merge branch 'main' into 'main'
Add Set Search Text/SetSearchText editor command to Set the current selection... See merge request freepascal.org/lazarus/lazarus!2
This commit is contained in:
commit
1a47228438
@ -376,6 +376,7 @@ const
|
||||
ecDesignerForwardOne = ecFirstLazarus + 1006;
|
||||
ecDesignerBackOne = ecFirstLazarus + 1007;
|
||||
ecDesignerToggleNonVisComps= ecFirstLazarus + 1008;
|
||||
ecSetSearchText = ecFirstLazarus + 1009;
|
||||
|
||||
|
||||
(* SynEdit Plugins
|
||||
@ -1935,7 +1936,7 @@ begin
|
||||
end;
|
||||
|
||||
const
|
||||
IDEEditorCommandStrs: array[0..323] of TIdentMapEntry = (
|
||||
IDEEditorCommandStrs: array[0..324] of TIdentMapEntry = (
|
||||
// search
|
||||
(Value: ecFind; Name: 'ecFind'),
|
||||
(Value: ecFindAgain; Name: 'ecFindAgain'),
|
||||
@ -1943,6 +1944,7 @@ const
|
||||
(Value: ecFindPrevious; Name: 'ecFindPrevious'),
|
||||
(Value: ecReplace; Name: 'ecReplace'),
|
||||
(Value: ecIncrementalFind; Name: 'ecIncrementalFind'),
|
||||
(Value: ecSetSearchText; Name: 'ecSetSearchText'),
|
||||
(Value: ecFindProcedureDefinition; Name: 'ecFindProcedureDefinition'),
|
||||
(Value: ecFindProcedureMethod; Name: 'ecFindProcedureMethod'),
|
||||
(Value: ecGotoLineNumber; Name: 'ecGotoLineNumber'),
|
||||
|
@ -584,6 +584,7 @@ begin
|
||||
ecFindInFiles : Result:= srkmecFindInFiles;
|
||||
ecReplace : Result:= srkmecReplace;
|
||||
ecIncrementalFind : Result:= lisMenuIncrementalFind;
|
||||
ecSetSearchText : Result:= lisMenuSetSearchText;
|
||||
ecFindProcedureDefinition : Result:= srkmecFindProcedureDefinition;
|
||||
ecFindProcedureMethod : Result:= srkmecFindProcedureMethod;
|
||||
ecGotoLineNumber : Result:= srkmecGotoLineNumber;
|
||||
@ -1152,6 +1153,7 @@ begin
|
||||
ecFindInFiles: SetSingle(VK_F,[XCtrl,ssShift]);
|
||||
ecReplace: SetCombo(VK_R,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_A,[]);
|
||||
ecIncrementalFind: SetSingle(VK_E,[XCtrl]);
|
||||
ecSetSearchText: SetCombo(VK_K,[XCtrl],VK_F,[]);
|
||||
ecGotoLineNumber: SetCombo(VK_G,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_G,[]);
|
||||
ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
@ -1613,6 +1615,7 @@ begin
|
||||
ecFindInFiles: SetSingle(VK_UNKNOWN,[]);
|
||||
ecReplace: SetCombo(VK_Q,[SSCtrl],VK_A,[]);
|
||||
ecIncrementalFind: SetSingle(VK_UNKNOWN,[]);
|
||||
ecSetSearchText: SetCombo(VK_K,[ssCtrl], VK_F,[]);
|
||||
ecGotoLineNumber: SetCombo(VK_Q,[ssCtrl],VK_G,[]);
|
||||
ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
@ -2242,6 +2245,7 @@ begin
|
||||
ecFindInFiles: SetSingle(VK_F,[ssMeta,ssShift]);
|
||||
ecReplace: SetSingle(VK_UNKNOWN,[]);
|
||||
ecIncrementalFind: SetSingle(VK_E,[ssMeta]);
|
||||
ecSetSearchText: SetCombo(VK_K,[SSCtrl],VK_F,[]);
|
||||
ecGotoLineNumber: SetSingle(VK_L,[ssMeta]);
|
||||
ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
|
||||
@ -2851,6 +2855,7 @@ begin
|
||||
AddDefault(C, 'Find in files', srkmecFindInFiles, ecFindInFiles);
|
||||
AddDefault(C, 'Replace text', srkmecReplace, ecReplace);
|
||||
AddDefault(C, 'Find incremental', lisKMFindIncremental, ecIncrementalFind);
|
||||
AddDefault(C, 'Set Search Text', lisKMSetSearchText, ecSetSearchText);
|
||||
AddDefault(C, 'Go to line number', srkmecGotoLineNumber, ecGotoLineNumber);
|
||||
AddDefault(C, 'Find next word occurrence', srkmecFindNextWordOccurrence, ecFindNextWordOccurrence);
|
||||
AddDefault(C, 'Find previous word occurrence', srkmecFindPrevWordOccurrence, ecFindPrevWordOccurrence);
|
||||
|
@ -385,6 +385,7 @@ resourcestring
|
||||
lisMenuFindPrevious = 'Find &Previous';
|
||||
lisMenuFindInFiles = 'Find &in Files ...';
|
||||
lisMenuIncrementalFind = 'Incremental Find';
|
||||
lisMenuSetSearchText = 'Set Search Text';
|
||||
lisMenuGotoLine = 'Goto Line ...';
|
||||
lisMenuJumpBack = 'Jump Back';
|
||||
lisMenuJumpForward = 'Jump Forward';
|
||||
@ -3293,6 +3294,7 @@ resourcestring
|
||||
srkmecFindInFiles = 'Find in Files';
|
||||
srkmecReplace = 'Replace Text';
|
||||
lisKMFindIncremental = 'Find Incremental';
|
||||
lisKMSetSearchText = 'Set Search Text';
|
||||
srkmecFindProcedureDefinition = 'Find Procedure Definiton';
|
||||
srkmecFindProcedureMethod = 'Find Procedure Method';
|
||||
srkmecGotoLineNumber = 'Go to Line Number';
|
||||
|
@ -140,6 +140,7 @@ type
|
||||
itmSearchFindInFiles: TIDEMenuCommand;
|
||||
itmSearchReplace: TIDEMenuCommand;
|
||||
itmIncrementalFind: TIDEMenuCommand;
|
||||
//itmSetSearchText: TIDEMenuCommand;
|
||||
//itmJumpings: TIDEMenuSection;
|
||||
itmGotoLine: TIDEMenuCommand;
|
||||
itmJumpBack: TIDEMenuCommand;
|
||||
|
@ -395,6 +395,7 @@ type
|
||||
function DoFindAndReplace(aFindText, aReplaceText: String; anOptions: TSynSearchOptions): Integer;
|
||||
procedure FindNextUTF8;
|
||||
procedure FindPrevious;
|
||||
procedure SetSearchText;
|
||||
procedure FindNextWordOccurrence(DirectionForward: boolean);
|
||||
procedure ShowGotoLineDialog;
|
||||
|
||||
@ -3691,6 +3692,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.SetSearchText;
|
||||
var
|
||||
S: string;
|
||||
begin
|
||||
if EditorComponent.SelAvail then
|
||||
S := EditorComponent.SelText
|
||||
else
|
||||
begin
|
||||
S := EditorComponent.GetWordAtRowCol(EditorComponent.LogicalCaretXY);
|
||||
//EditorComponent.Flags:=[ssoWholeWord];
|
||||
end;
|
||||
if S <> '' then begin
|
||||
FSourceNoteBook.BeginIncrementalFind;
|
||||
FSourceNoteBook.IncrementalSearchStr := S;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceEditor.FindNextWordOccurrence(DirectionForward: boolean);
|
||||
var
|
||||
StartX, EndX: Integer;
|
||||
@ -4131,6 +4149,7 @@ Begin
|
||||
ecFindNext: FindNextUTF8;
|
||||
ecFindPrevious: FindPrevious;
|
||||
ecIncrementalFind: if FSourceNoteBook<>nil then FSourceNoteBook.BeginIncrementalFind;
|
||||
ecSetSearchText: if FSourceNoteBook<>nil then SetSearchText;
|
||||
ecReplace: StartFindAndReplace(true);
|
||||
ecGotoLineNumber: ShowGotoLineDialog;
|
||||
ecFindNextWordOccurrence: FindNextWordOccurrence(true);
|
||||
|
Loading…
Reference in New Issue
Block a user