diff --git a/ide/main.pp b/ide/main.pp index 5640939630..1be8bd0de2 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -8112,8 +8112,10 @@ begin exit; if Msg=nil then begin + // first find an error with a source position if MessagesView.SelectFirstUrgentMessage(mluError,true) then Msg:=MessagesView.GetSelectedLine; + // then find any error if (Msg=nil) and MessagesView.SelectFirstUrgentMessage(mluError,false) then Msg:=MessagesView.GetSelectedLine; if Msg=nil then exit; @@ -8276,9 +8278,6 @@ begin // don't move the messagesview, if it was already visible. IDEWindowCreators.ShowForm(MessagesView,BringToFront); - if BringToFront then - // the sourcenotebook is more interesting than the messages - SourceEditorManager.ShowActiveWindowOnTop(False); end; procedure TMainIDE.DoShowSearchResultsView(Show: boolean; BringToFront: boolean = False); @@ -8288,10 +8287,7 @@ begin SearchresultsView.OnSelectionChanged := OnSearchResultsViewSelectionChanged; end; if Show then begin - IDEWindowCreators.ShowForm(SearchresultsView,Show); - // the sourcenotebook is more interesting than the search results - if BringToFront = false then - SourceEditorManager.ShowActiveWindowOnTop(False); + IDEWindowCreators.ShowForm(SearchresultsView,BringToFront); end; end; diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas index 85f5dd3a6b..52dd6b12e5 100644 --- a/ide/sourcefilemanager.pas +++ b/ide/sourcefilemanager.pas @@ -1533,20 +1533,23 @@ var SrcNoteBook: TSourceNotebook; Layout: TSimpleWindowLayout; begin - MainIDE.DoShowMessagesView(PutOnTop); - if SourceEditorManager.SourceWindowCount = 0 then exit; - SrcNoteBook := SourceEditorManager.SourceWindows[0]; - - Layout:=IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(SrcNoteBook.Name); - if (Layout<>nil) and (Layout.WindowPlacement=iwpDefault) - and ((SrcNoteBook.Top + SrcNoteBook.Height) > MessagesView.Top) - and (MessagesView.Parent = nil) then - SrcNoteBook.Height := Max(50,Min(SrcNoteBook.Height,MessagesView.Top-SrcNoteBook.Top)); - if PutOnTop then + if SourceEditorManager.SourceWindowCount > 0 then begin - IDEWindowCreators.ShowForm(MessagesView,true); - SourceEditorManager.ShowActiveWindowOnTop(False); + SrcNoteBook := SourceEditorManager.SourceWindows[0]; + + Layout:=IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(SrcNoteBook.Name); + if (Layout<>nil) and (Layout.WindowPlacement=iwpDefault) + and ((SrcNoteBook.Top + SrcNoteBook.Height) > MessagesView.Top) + and (MessagesView.Parent = nil) then + SrcNoteBook.Height := Max(50,Min(SrcNoteBook.Height,MessagesView.Top-SrcNoteBook.Top)); + if PutOnTop then + begin + IDEWindowCreators.ShowForm(MessagesView,true); + SourceEditorManager.ShowActiveWindowOnTop(False); + exit; + end; end; + MainIDE.DoShowMessagesView(PutOnTop); end; function TLazSourceFileManager.SomethingOfProjectIsModified(Verbose: boolean): boolean;