mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Standardise on 'screen mode' name
We had some conflicting names so we're standardising on screen mode
This commit is contained in:
parent
2c321011db
commit
28d10c26a4
9 changed files with 40 additions and 33 deletions
|
@ -200,7 +200,7 @@ Undo uses the reflog which is specific to commits and branches so we can't undo
|
||||||
|
|
||||||
### Commit graph
|
### Commit graph
|
||||||
|
|
||||||
When viewing the commit graph in an enlarged window (use `+` and `_` to cycle window sizes), the commit graph is shown. Colours correspond to the commit authors, and as you navigate down the graph, the parent commits of the selected commit are highlighted.
|
When viewing the commit graph in an enlarged window (use `+` and `_` to cycle screen modes), the commit graph is shown. Colours correspond to the commit authors, and as you navigate down the graph, the parent commits of the selected commit are highlighted.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
@ -219,9 +219,9 @@ gui:
|
||||||
# If 'auto', only split the main window when a file has both staged and unstaged changes
|
# If 'auto', only split the main window when a file has both staged and unstaged changes
|
||||||
splitDiff: auto
|
splitDiff: auto
|
||||||
|
|
||||||
# Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
|
# Default size for focused window. Can be changed from within Lazygit with '+' and '_' (but this won't change the default).
|
||||||
# One of: 'normal' (default) | 'half' | 'full'
|
# One of: 'normal' (default) | 'half' | 'full'
|
||||||
windowSize: normal
|
screenMode: normal
|
||||||
|
|
||||||
# Window border style.
|
# Window border style.
|
||||||
# One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
# One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
||||||
|
|
|
@ -217,16 +217,23 @@ func loadUserConfig(configFiles []*ConfigFile, base *UserConfig) (*UserConfig, e
|
||||||
// from one container to another, or changing the type of a key (e.g. from bool
|
// from one container to another, or changing the type of a key (e.g. from bool
|
||||||
// to an enum).
|
// to an enum).
|
||||||
func migrateUserConfig(path string, content []byte) ([]byte, error) {
|
func migrateUserConfig(path string, content []byte) ([]byte, error) {
|
||||||
changedContent, err := yaml_utils.RenameYamlKey(content, []string{"gui", "skipUnstageLineWarning"},
|
changedContent := content
|
||||||
"skipDiscardChangeWarning")
|
|
||||||
if err != nil {
|
pathsToReplace := []struct {
|
||||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
oldPath []string
|
||||||
|
newName string
|
||||||
|
}{
|
||||||
|
{[]string{"gui", "skipUnstageLineWarning"}, "skipDiscardChangeWarning"},
|
||||||
|
{[]string{"keybinding", "universal", "executeCustomCommand"}, "executeShellCommand"},
|
||||||
|
{[]string{"gui", "windowSize"}, "screenMode"},
|
||||||
}
|
}
|
||||||
|
|
||||||
changedContent, err = yaml_utils.RenameYamlKey(changedContent, []string{"keybinding", "universal", "executeCustomCommand"},
|
var err error
|
||||||
"executeShellCommand")
|
for _, pathToReplace := range pathsToReplace {
|
||||||
|
changedContent, err = yaml_utils.RenameYamlKey(changedContent, pathToReplace.oldPath, pathToReplace.newName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
return nil, fmt.Errorf("Couldn't migrate config file at `%s` for key %s: %s", path, strings.Join(pathToReplace.oldPath, "."), err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changedContent, err = changeNullKeybindingsToDisabled(changedContent)
|
changedContent, err = changeNullKeybindingsToDisabled(changedContent)
|
||||||
|
|
|
@ -148,9 +148,9 @@ type GuiConfig struct {
|
||||||
// One of: 'auto' | 'always'
|
// One of: 'auto' | 'always'
|
||||||
// If 'auto', only split the main window when a file has both staged and unstaged changes
|
// If 'auto', only split the main window when a file has both staged and unstaged changes
|
||||||
SplitDiff string `yaml:"splitDiff" jsonschema:"enum=auto,enum=always"`
|
SplitDiff string `yaml:"splitDiff" jsonschema:"enum=auto,enum=always"`
|
||||||
// Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
|
// Default size for focused window. Can be changed from within Lazygit with '+' and '_' (but this won't change the default).
|
||||||
// One of: 'normal' (default) | 'half' | 'full'
|
// One of: 'normal' (default) | 'half' | 'full'
|
||||||
WindowSize string `yaml:"windowSize" jsonschema:"enum=normal,enum=half,enum=full"`
|
ScreenMode string `yaml:"screenMode" jsonschema:"enum=normal,enum=half,enum=full"`
|
||||||
// Window border style.
|
// Window border style.
|
||||||
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
||||||
Border string `yaml:"border" jsonschema:"enum=single,enum=double,enum=rounded,enum=hidden"`
|
Border string `yaml:"border" jsonschema:"enum=single,enum=double,enum=rounded,enum=hidden"`
|
||||||
|
@ -734,7 +734,7 @@ func GetDefaultConfig() *UserConfig {
|
||||||
CommandLogSize: 8,
|
CommandLogSize: 8,
|
||||||
SplitDiff: "auto",
|
SplitDiff: "auto",
|
||||||
SkipRewordInEditorWarning: false,
|
SkipRewordInEditorWarning: false,
|
||||||
WindowSize: "normal",
|
ScreenMode: "normal",
|
||||||
Border: "rounded",
|
Border: "rounded",
|
||||||
AnimateExplosion: true,
|
AnimateExplosion: true,
|
||||||
PortraitMode: "auto",
|
PortraitMode: "auto",
|
||||||
|
|
|
@ -53,7 +53,7 @@ type WindowArrangementArgs struct {
|
||||||
// staged and unstaged changes)
|
// staged and unstaged changes)
|
||||||
SplitMainPanel bool
|
SplitMainPanel bool
|
||||||
// The current screen mode (normal, half, full)
|
// The current screen mode (normal, half, full)
|
||||||
ScreenMode types.WindowMaximisation
|
ScreenMode types.ScreenMode
|
||||||
// The content shown on the bottom left of the screen when showing a loader
|
// The content shown on the bottom left of the screen when showing a loader
|
||||||
// or toast e.g. 'Rebasing /'
|
// or toast e.g. 'Rebasing /'
|
||||||
AppStatus string
|
AppStatus string
|
||||||
|
|
|
@ -12,7 +12,7 @@ type ScreenModeActions struct {
|
||||||
func (self *ScreenModeActions) Next() error {
|
func (self *ScreenModeActions) Next() error {
|
||||||
self.c.State().GetRepoState().SetScreenMode(
|
self.c.State().GetRepoState().SetScreenMode(
|
||||||
nextIntInCycle(
|
nextIntInCycle(
|
||||||
[]types.WindowMaximisation{types.SCREEN_NORMAL, types.SCREEN_HALF, types.SCREEN_FULL},
|
[]types.ScreenMode{types.SCREEN_NORMAL, types.SCREEN_HALF, types.SCREEN_FULL},
|
||||||
self.c.State().GetRepoState().GetScreenMode(),
|
self.c.State().GetRepoState().GetScreenMode(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ func (self *ScreenModeActions) Next() error {
|
||||||
func (self *ScreenModeActions) Prev() error {
|
func (self *ScreenModeActions) Prev() error {
|
||||||
self.c.State().GetRepoState().SetScreenMode(
|
self.c.State().GetRepoState().SetScreenMode(
|
||||||
prevIntInCycle(
|
prevIntInCycle(
|
||||||
[]types.WindowMaximisation{types.SCREEN_NORMAL, types.SCREEN_HALF, types.SCREEN_FULL},
|
[]types.ScreenMode{types.SCREEN_NORMAL, types.SCREEN_HALF, types.SCREEN_FULL},
|
||||||
self.c.State().GetRepoState().GetScreenMode(),
|
self.c.State().GetRepoState().GetScreenMode(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -53,7 +53,7 @@ func (self *ScreenModeActions) rerenderView(view *gocui.View) {
|
||||||
context.HandleRender()
|
context.HandleRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
func nextIntInCycle(sl []types.WindowMaximisation, current types.WindowMaximisation) types.WindowMaximisation {
|
func nextIntInCycle(sl []types.ScreenMode, current types.ScreenMode) types.ScreenMode {
|
||||||
for i, val := range sl {
|
for i, val := range sl {
|
||||||
if val == current {
|
if val == current {
|
||||||
if i == len(sl)-1 {
|
if i == len(sl)-1 {
|
||||||
|
@ -65,7 +65,7 @@ func nextIntInCycle(sl []types.WindowMaximisation, current types.WindowMaximisat
|
||||||
return sl[0]
|
return sl[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
func prevIntInCycle(sl []types.WindowMaximisation, current types.WindowMaximisation) types.WindowMaximisation {
|
func prevIntInCycle(sl []types.ScreenMode, current types.ScreenMode) types.ScreenMode {
|
||||||
for i, val := range sl {
|
for i, val := range sl {
|
||||||
if val == current {
|
if val == current {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
|
|
|
@ -244,7 +244,7 @@ type GuiRepoState struct {
|
||||||
// back in sync with the repo state
|
// back in sync with the repo state
|
||||||
ViewsSetup bool
|
ViewsSetup bool
|
||||||
|
|
||||||
ScreenMode types.WindowMaximisation
|
ScreenMode types.ScreenMode
|
||||||
|
|
||||||
CurrentPopupOpts *types.CreatePopupPanelOpts
|
CurrentPopupOpts *types.CreatePopupPanelOpts
|
||||||
}
|
}
|
||||||
|
@ -275,11 +275,11 @@ func (self *GuiRepoState) SetCurrentPopupOpts(value *types.CreatePopupPanelOpts)
|
||||||
self.CurrentPopupOpts = value
|
self.CurrentPopupOpts = value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *GuiRepoState) GetScreenMode() types.WindowMaximisation {
|
func (self *GuiRepoState) GetScreenMode() types.ScreenMode {
|
||||||
return self.ScreenMode
|
return self.ScreenMode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *GuiRepoState) SetScreenMode(value types.WindowMaximisation) {
|
func (self *GuiRepoState) SetScreenMode(value types.ScreenMode) {
|
||||||
self.ScreenMode = value
|
self.ScreenMode = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,18 +580,18 @@ func initialWindowViewNameMap(contextTree *context.ContextTree) *utils.ThreadSaf
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) types.WindowMaximisation {
|
func initialScreenMode(startArgs appTypes.StartArgs, config config.AppConfigurer) types.ScreenMode {
|
||||||
if startArgs.ScreenMode != "" {
|
if startArgs.ScreenMode != "" {
|
||||||
return getWindowMaximisation(startArgs.ScreenMode)
|
return parseScreenModeArg(startArgs.ScreenMode)
|
||||||
} else if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
|
} else if startArgs.FilterPath != "" || startArgs.GitArg != appTypes.GitArgNone {
|
||||||
return types.SCREEN_HALF
|
return types.SCREEN_HALF
|
||||||
} else {
|
} else {
|
||||||
return getWindowMaximisation(config.GetUserConfig().Gui.WindowSize)
|
return parseScreenModeArg(config.GetUserConfig().Gui.ScreenMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWindowMaximisation(modeString string) types.WindowMaximisation {
|
func parseScreenModeArg(screenModeArg string) types.ScreenMode {
|
||||||
switch modeString {
|
switch screenModeArg {
|
||||||
case "half":
|
case "half":
|
||||||
return types.SCREEN_HALF
|
return types.SCREEN_HALF
|
||||||
case "full":
|
case "full":
|
||||||
|
|
|
@ -362,8 +362,8 @@ type IRepoStateAccessor interface {
|
||||||
SetStartupStage(stage StartupStage)
|
SetStartupStage(stage StartupStage)
|
||||||
GetCurrentPopupOpts() *CreatePopupPanelOpts
|
GetCurrentPopupOpts() *CreatePopupPanelOpts
|
||||||
SetCurrentPopupOpts(*CreatePopupPanelOpts)
|
SetCurrentPopupOpts(*CreatePopupPanelOpts)
|
||||||
GetScreenMode() WindowMaximisation
|
GetScreenMode() ScreenMode
|
||||||
SetScreenMode(WindowMaximisation)
|
SetScreenMode(ScreenMode)
|
||||||
InSearchPrompt() bool
|
InSearchPrompt() bool
|
||||||
GetSearchState() *SearchState
|
GetSearchState() *SearchState
|
||||||
SetSplitMainPanel(bool)
|
SetSplitMainPanel(bool)
|
||||||
|
@ -382,10 +382,10 @@ const (
|
||||||
// as in panel, not your terminal's window). Sometimes you want a bit more space
|
// 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
|
// to see the contents of a panel, and this keeps track of how much maximisation
|
||||||
// you've set
|
// you've set
|
||||||
type WindowMaximisation int
|
type ScreenMode int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SCREEN_NORMAL WindowMaximisation = iota
|
SCREEN_NORMAL ScreenMode = iota
|
||||||
SCREEN_HALF
|
SCREEN_HALF
|
||||||
SCREEN_FULL
|
SCREEN_FULL
|
||||||
)
|
)
|
||||||
|
|
|
@ -388,14 +388,14 @@
|
||||||
"description": "Whether to split the main window when viewing file changes.\nOne of: 'auto' | 'always'\nIf 'auto', only split the main window when a file has both staged and unstaged changes",
|
"description": "Whether to split the main window when viewing file changes.\nOne of: 'auto' | 'always'\nIf 'auto', only split the main window when a file has both staged and unstaged changes",
|
||||||
"default": "auto"
|
"default": "auto"
|
||||||
},
|
},
|
||||||
"windowSize": {
|
"screenMode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"normal",
|
"normal",
|
||||||
"half",
|
"half",
|
||||||
"full"
|
"full"
|
||||||
],
|
],
|
||||||
"description": "Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).\nOne of: 'normal' (default) | 'half' | 'full'",
|
"description": "Default size for focused window. Can be changed from within Lazygit with '+' and '_' (but this won't change the default).\nOne of: 'normal' (default) | 'half' | 'full'",
|
||||||
"default": "normal"
|
"default": "normal"
|
||||||
},
|
},
|
||||||
"border": {
|
"border": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue