1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

start moving getDisplayStrings funcs into contexts

This commit is contained in:
Jesse Duffield
2023-03-21 21:38:37 +11:00
parent 0e5a4c7a36
commit 1b2fb34ffd
7 changed files with 52 additions and 46 deletions

View File

@ -42,18 +42,6 @@ import (
"gopkg.in/ozeidan/fuzzy-patricia.v3/patricia"
)
// screen sizing determines how much space your selected window takes up (window
// as in panel, not your terminal's window). Sometimes you want a bit more space
// to see the contents of a panel, and this keeps track of how much maximisation
// you've set
type WindowMaximisation int
const (
SCREEN_NORMAL WindowMaximisation = iota
SCREEN_HALF
SCREEN_FULL
)
const StartupPopupVersion = 5
// OverlappingEdges determines if panel edges overlap
@ -216,7 +204,7 @@ type GuiRepoState struct {
// panel without committing or if our commit failed
savedCommitMessage string
ScreenMode WindowMaximisation
ScreenMode types.WindowMaximisation
CurrentPopupOpts *types.CreatePopupPanelOpts
}
@ -247,6 +235,10 @@ func (self *GuiRepoState) SetCurrentPopupOpts(value *types.CreatePopupPanelOpts)
self.CurrentPopupOpts = value
}
func (self *GuiRepoState) GetScreenMode() types.WindowMaximisation {
return self.ScreenMode
}
type searchingState struct {
view *gocui.View
isSearching bool
@ -353,19 +345,19 @@ func initialWindowViewNameMap(contextTree *context.ContextTree) *utils.ThreadSaf
return result
}
func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) WindowMaximisation {
func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) types.WindowMaximisation {
if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
return SCREEN_HALF
return types.SCREEN_HALF
} else {
defaultWindowSize := config.GetUserConfig().Gui.WindowSize
switch defaultWindowSize {
case "half":
return SCREEN_HALF
return types.SCREEN_HALF
case "full":
return SCREEN_FULL
return types.SCREEN_FULL
default:
return SCREEN_NORMAL
return types.SCREEN_NORMAL
}
}
}