mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 08:39:41 +02:00
IDE: fix jump point on file search result open (bug was: when opening result from a different file, the jump point in the new file was added and not the current one)
git-svn-id: trunk@57895 -
This commit is contained in:
parent
c25de54334
commit
f549ecc47d
14
ide/main.pp
14
ide/main.pp
@ -8754,11 +8754,12 @@ function TMainIDE.DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
|||||||
var
|
var
|
||||||
AFileName: string;
|
AFileName: string;
|
||||||
SearchedFilename: string;
|
SearchedFilename: string;
|
||||||
LogCaretXY: TPoint;
|
LogCaretXY, JumpPointCaretXY: TPoint;
|
||||||
OpenFlags: TOpenFlags;
|
OpenFlags: TOpenFlags;
|
||||||
SrcEdit: TSourceEditor;
|
SrcEdit, JumpPointEditor: TSourceEditor;
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
AnEditorInfo: TUnitEditorInfo;
|
AnEditorInfo: TUnitEditorInfo;
|
||||||
|
JumpPointTopLine: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
AFileName:= SearchResultsView.GetSourceFileName;
|
AFileName:= SearchResultsView.GetSourceFileName;
|
||||||
@ -8773,6 +8774,12 @@ begin
|
|||||||
SearchedFilename := FindUnitFile(AFilename);
|
SearchedFilename := FindUnitFile(AFilename);
|
||||||
end;
|
end;
|
||||||
if SearchedFilename<>'' then begin
|
if SearchedFilename<>'' then begin
|
||||||
|
JumpPointEditor := SourceEditorManager.ActiveEditor;
|
||||||
|
if JumpPointEditor<>nil then
|
||||||
|
begin
|
||||||
|
JumpPointCaretXY := JumpPointEditor.EditorComponent.LogicalCaretXY;
|
||||||
|
JumpPointTopLine := JumpPointEditor.EditorComponent.TopLine;
|
||||||
|
end;
|
||||||
// open the file in the source editor
|
// open the file in the source editor
|
||||||
AnUnitInfo := nil;
|
AnUnitInfo := nil;
|
||||||
if Project1<>nil then
|
if Project1<>nil then
|
||||||
@ -8787,7 +8794,8 @@ begin
|
|||||||
Result:=(DoOpenEditorFile(SearchedFilename,-1,-1,OpenFlags)=mrOk);
|
Result:=(DoOpenEditorFile(SearchedFilename,-1,-1,OpenFlags)=mrOk);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
// set caret position
|
// set caret position
|
||||||
SourceEditorManager.AddJumpPointClicked(Self);
|
if JumpPointEditor<>nil then
|
||||||
|
SourceEditorManager.AddCustomJumpPoint(JumpPointCaretXY, JumpPointTopLine, JumpPointEditor, True);
|
||||||
SrcEdit:=SourceEditorManager.ActiveEditor;
|
SrcEdit:=SourceEditorManager.ActiveEditor;
|
||||||
if LogCaretXY.Y>SrcEdit.EditorComponent.Lines.Count then
|
if LogCaretXY.Y>SrcEdit.EditorComponent.Lines.Count then
|
||||||
LogCaretXY.Y:=SrcEdit.EditorComponent.Lines.Count;
|
LogCaretXY.Y:=SrcEdit.EditorComponent.Lines.Count;
|
||||||
|
@ -1118,6 +1118,8 @@ type
|
|||||||
procedure JumpBackClicked(Sender: TObject);
|
procedure JumpBackClicked(Sender: TObject);
|
||||||
procedure JumpForwardClicked(Sender: TObject);
|
procedure JumpForwardClicked(Sender: TObject);
|
||||||
procedure AddJumpPointClicked(Sender: TObject);
|
procedure AddJumpPointClicked(Sender: TObject);
|
||||||
|
procedure AddCustomJumpPoint(ACaretXY: TPoint; ATopLine: integer;
|
||||||
|
AEditor: TSourceEditor; DeleteForwardHistory: boolean);
|
||||||
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
||||||
procedure ViewJumpHistoryClicked(Sender: TObject);
|
procedure ViewJumpHistoryClicked(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
@ -9746,6 +9748,13 @@ begin
|
|||||||
ActiveSourceWindow := Result;
|
ActiveSourceWindow := Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditorManager.AddCustomJumpPoint(ACaretXY: TPoint;
|
||||||
|
ATopLine: integer; AEditor: TSourceEditor; DeleteForwardHistory: boolean);
|
||||||
|
begin
|
||||||
|
if Assigned(OnAddJumpPoint) then
|
||||||
|
OnAddJumpPoint(ACaretXY, ATopLine, AEditor, DeleteForwardHistory);
|
||||||
|
end;
|
||||||
|
|
||||||
function TSourceEditorManager.NewSourceWindow: TSourceNotebook;
|
function TSourceEditorManager.NewSourceWindow: TSourceNotebook;
|
||||||
begin
|
begin
|
||||||
Result := CreateNewWindow(True);
|
Result := CreateNewWindow(True);
|
||||||
|
Loading…
Reference in New Issue
Block a user