Skip to content

Commit ab1e6d5

Browse files
committed
Fix window arrangement when a popup or the search prompt is open
When focusing the main view, going into full screen mode by pressing '+' twice, and then opening the search prompt ('/') or a menu (e.g. '?' or ':'), the full screen display would switch to the focused side panel. Fix this by always excluding popups from the window arrangement logic. No popup should ever have any influence on how the views beneath it are laid out.
1 parent 1fd771f commit ab1e6d5

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

pkg/gui/controllers/helpers/window_arrangement_helper.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ type WindowArrangementArgs struct {
4343
Height int
4444
// User config
4545
UserConfig *config.UserConfig
46-
// Name of the currently focused window
46+
// Name of the currently focused window. (It's actually the current static window, meaning
47+
// popups are ignored)
4748
CurrentWindow string
48-
// Name of the current static window (meaning popups are ignored)
49-
CurrentStaticWindow string
5049
// Name of the current side window (i.e. the current window in the left
5150
// section of the UI)
5251
CurrentSideWindow string
@@ -86,21 +85,20 @@ func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string,
8685
}
8786

8887
args := WindowArrangementArgs{
89-
Width: width,
90-
Height: height,
91-
UserConfig: self.c.UserConfig(),
92-
CurrentWindow: self.windowHelper.CurrentWindow(),
93-
CurrentSideWindow: self.c.Context().CurrentSide().GetWindowName(),
94-
CurrentStaticWindow: self.c.Context().CurrentStatic().GetWindowName(),
95-
SplitMainPanel: repoState.GetSplitMainPanel(),
96-
ScreenMode: repoState.GetScreenMode(),
97-
AppStatus: appStatus,
98-
InformationStr: informationStr,
99-
ShowExtrasWindow: self.c.State().GetShowExtrasWindow(),
100-
InDemo: self.c.InDemo(),
101-
IsAnyModeActive: self.modeHelper.IsAnyModeActive(),
102-
InSearchPrompt: repoState.InSearchPrompt(),
103-
SearchPrefix: searchPrefix,
88+
Width: width,
89+
Height: height,
90+
UserConfig: self.c.UserConfig(),
91+
CurrentWindow: self.c.Context().CurrentStatic().GetWindowName(),
92+
CurrentSideWindow: self.c.Context().CurrentSide().GetWindowName(),
93+
SplitMainPanel: repoState.GetSplitMainPanel(),
94+
ScreenMode: repoState.GetScreenMode(),
95+
AppStatus: appStatus,
96+
InformationStr: informationStr,
97+
ShowExtrasWindow: self.c.State().GetShowExtrasWindow(),
98+
InDemo: self.c.InDemo(),
99+
IsAnyModeActive: self.modeHelper.IsAnyModeActive(),
100+
InSearchPrompt: repoState.InSearchPrompt(),
101+
SearchPrefix: searchPrefix,
104102
}
105103

106104
return GetWindowDimensions(args)
@@ -393,7 +391,7 @@ func splitMainPanelSideBySide(args WindowArrangementArgs) bool {
393391
func getExtrasWindowSize(args WindowArrangementArgs) int {
394392
var baseSize int
395393
// The 'extras' window contains the command log context
396-
if args.CurrentStaticWindow == "extras" {
394+
if args.CurrentWindow == "extras" {
397395
baseSize = 1000 // my way of saying 'fill the available space'
398396
} else if args.Height < 40 {
399397
baseSize = 1

pkg/gui/controllers/helpers/window_arrangement_helper_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@ import (
1919
func TestGetWindowDimensions(t *testing.T) {
2020
getDefaultArgs := func() WindowArrangementArgs {
2121
return WindowArrangementArgs{
22-
Width: 75,
23-
Height: 30,
24-
UserConfig: config.GetDefaultConfig(),
25-
CurrentWindow: "files",
26-
CurrentSideWindow: "files",
27-
CurrentStaticWindow: "files",
28-
SplitMainPanel: false,
29-
ScreenMode: types.SCREEN_NORMAL,
30-
AppStatus: "",
31-
InformationStr: "information",
32-
ShowExtrasWindow: false,
33-
InDemo: false,
34-
IsAnyModeActive: false,
35-
InSearchPrompt: false,
36-
SearchPrefix: "",
22+
Width: 75,
23+
Height: 30,
24+
UserConfig: config.GetDefaultConfig(),
25+
CurrentWindow: "files",
26+
CurrentSideWindow: "files",
27+
SplitMainPanel: false,
28+
ScreenMode: types.SCREEN_NORMAL,
29+
AppStatus: "",
30+
InformationStr: "information",
31+
ShowExtrasWindow: false,
32+
InDemo: false,
33+
IsAnyModeActive: false,
34+
InSearchPrompt: false,
35+
SearchPrefix: "",
3736
}
3837
}
3938

0 commit comments

Comments
 (0)