mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Return only visible views from TopViewInWindow
Without this it's not reliably possible to ask whether a given view is visible by asking windowHelper.TopViewInWindow(context.GetWindowName()) == context.GetView() because there could be transient, invisible contexts after it in the Z order. I guess it's a bit of a coincidence that this has never been a problem so far.
This commit is contained in:
@ -92,7 +92,7 @@ func (self *WindowHelper) MoveToTopOfWindow(context types.Context) {
|
||||
|
||||
topView := self.TopViewInWindow(window)
|
||||
|
||||
if view.Name() != topView.Name() {
|
||||
if topView != nil && view.Name() != topView.Name() {
|
||||
if err := self.c.GocuiGui().SetViewOnTopOf(view.Name(), topView.Name()); err != nil {
|
||||
self.c.Log.Error(err)
|
||||
}
|
||||
@ -106,7 +106,7 @@ func (self *WindowHelper) TopViewInWindow(windowName string) *gocui.View {
|
||||
// The views list is ordered highest-last, so we're grabbing the last view of the window
|
||||
var topView *gocui.View
|
||||
for _, currentView := range self.c.GocuiGui().Views() {
|
||||
if lo.Contains(viewNamesInWindow, currentView.Name()) {
|
||||
if lo.Contains(viewNamesInWindow, currentView.Name()) && currentView.Visible {
|
||||
topView = currentView
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user