Skip to content

Commit 0d45df0

Browse files
committed
Standardise panel size naming
We had some conflicting names: screen-mode, window-size, and window-maximisation. I think panel-size sounds good.
1 parent 2d193cb commit 0d45df0

38 files changed

+221
-215
lines changed

docs/Config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ gui:
8181
# - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
8282
mainPanelSplitMode: flexible
8383

84-
# How the window is split when in half screen mode (i.e. after hitting '+' once).
84+
# How the window is split when in half panel-size mode (i.e. after hitting '+' once).
8585
# Possible values:
8686
# - 'left': split the window horizontally (side panel on the left, main view on the right)
8787
# - 'top': split the window vertically (side panel on top, main view below)
@@ -221,7 +221,7 @@ gui:
221221

222222
# Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
223223
# One of: 'normal' (default) | 'half' | 'full'
224-
windowSize: normal
224+
panelSize: normal
225225

226226
# Window border style.
227227
# One of 'rounded' (default) | 'single' | 'double' | 'hidden'
@@ -532,8 +532,8 @@ keybinding:
532532
createPatchOptionsMenu: <c-p>
533533
nextTab: ']'
534534
prevTab: '['
535-
nextScreenMode: +
536-
prevScreenMode: _
535+
nextPanelSize: +
536+
prevPanelSize: _
537537
undo: z
538538
redo: <c-z>
539539
filteringMenu: <c-s>

docs/keybindings/Keybindings_en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
2222
| `` <c-p> `` | View custom patch options | |
2323
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
2424
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
25-
| `` + `` | Next screen mode (normal/half/fullscreen) | |
26-
| `` _ `` | Prev screen mode | |
25+
| `` + `` | Next panel size (normal/half/fullscreen) | |
26+
| `` _ `` | Prev panel size | |
2727
| `` ? `` | Open keybindings menu | |
2828
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
2929
| `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |

pkg/app/entry_point.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type cliArgs struct {
3333
WorkTree string
3434
GitDir string
3535
CustomConfigFile string
36-
ScreenMode string
36+
PanelSize string
3737
PrintVersionInfo bool
3838
Debug bool
3939
TailLogs bool
@@ -165,7 +165,7 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
165165

166166
parsedGitArg := parseGitArg(cliArgs.GitArg)
167167

168-
Run(appConfig, common, appTypes.NewStartArgs(cliArgs.FilterPath, parsedGitArg, cliArgs.ScreenMode, integrationTest))
168+
Run(appConfig, common, appTypes.NewStartArgs(cliArgs.FilterPath, parsedGitArg, cliArgs.PanelSize, integrationTest))
169169
}
170170

171171
func parseCliArgsAndEnvVars() *cliArgs {
@@ -210,8 +210,8 @@ func parseCliArgsAndEnvVars() *cliArgs {
210210
customConfigFile := ""
211211
flaggy.String(&customConfigFile, "ucf", "use-config-file", "Comma separated list to custom config file(s)")
212212

213-
screenMode := ""
214-
flaggy.String(&screenMode, "sm", "screen-mode", "The initial screen-mode, which determines the size of the focused panel. Valid options: 'normal' (default), 'half', 'full'")
213+
PanelSize := ""
214+
flaggy.String(&PanelSize, "ps", "panel-size", "The initial size of the focused panel. Valid options: 'normal' (default), 'half', 'full'")
215215

216216
flaggy.Parse()
217217

@@ -233,7 +233,7 @@ func parseCliArgsAndEnvVars() *cliArgs {
233233
WorkTree: workTree,
234234
GitDir: gitDir,
235235
CustomConfigFile: customConfigFile,
236-
ScreenMode: screenMode,
236+
PanelSize: PanelSize,
237237
}
238238
}
239239

pkg/app/types/types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ type StartArgs struct {
1212
IntegrationTest integrationTypes.IntegrationTest
1313
// FilterPath determines which path we're going to filter on so that we only see commits from that file.
1414
FilterPath string
15-
// ScreenMode determines the initial Screen Mode (normal, half or full) to use
16-
ScreenMode string
15+
// PanelSize determines the initial panel size (normal, half or full) to use
16+
PanelSize string
1717
}
1818

1919
type GitArg string
@@ -26,11 +26,11 @@ const (
2626
GitArgStash GitArg = "stash"
2727
)
2828

29-
func NewStartArgs(filterPath string, gitArg GitArg, screenMode string, test integrationTypes.IntegrationTest) StartArgs {
29+
func NewStartArgs(filterPath string, gitArg GitArg, PanelSize string, test integrationTypes.IntegrationTest) StartArgs {
3030
return StartArgs{
3131
FilterPath: filterPath,
3232
GitArg: gitArg,
33-
ScreenMode: screenMode,
33+
PanelSize: PanelSize,
3434
IntegrationTest: test,
3535
}
3636
}

pkg/config/app_config.go

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,25 @@ func loadUserConfig(configFiles []*ConfigFile, base *UserConfig) (*UserConfig, e
217217
// from one container to another, or changing the type of a key (e.g. from bool
218218
// to an enum).
219219
func migrateUserConfig(path string, content []byte) ([]byte, error) {
220-
changedContent, err := yaml_utils.RenameYamlKey(content, []string{"gui", "skipUnstageLineWarning"},
221-
"skipDiscardChangeWarning")
222-
if err != nil {
223-
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
224-
}
225-
226-
changedContent, err = yaml_utils.RenameYamlKey(changedContent, []string{"keybinding", "universal", "executeCustomCommand"},
227-
"executeShellCommand")
228-
if err != nil {
229-
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
220+
changedContent := content
221+
222+
pathsToReplace := []struct {
223+
oldPath []string
224+
newName string
225+
}{
226+
{[]string{"gui", "skipUnstageLineWarning"}, "skipDiscardChangeWarning"},
227+
{[]string{"keybinding", "universal", "executeCustomCommand"}, "executeShellCommand"},
228+
{[]string{"gui", "windowSize"}, "panelSize"},
229+
{[]string{"keybinding", "nextScreenMode"}, "nextPanelSize"},
230+
{[]string{"keybinding", "prevScreenMode"}, "prevPanelSize"},
231+
}
232+
233+
var err error
234+
for _, pathToReplace := range pathsToReplace {
235+
changedContent, err = yaml_utils.RenameYamlKey(changedContent, pathToReplace.oldPath, pathToReplace.newName)
236+
if err != nil {
237+
return nil, fmt.Errorf("Couldn't migrate config file at `%s` for key %s: %s", path, strings.Join(pathToReplace.oldPath, "."), err)
238+
}
230239
}
231240

232241
changedContent, err = changeNullKeybindingsToDisabled(changedContent)

pkg/config/user_config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type GuiConfig struct {
8686
// - 'vertical': split the window vertically
8787
// - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
8888
MainPanelSplitMode string `yaml:"mainPanelSplitMode" jsonschema:"enum=horizontal,enum=flexible,enum=vertical"`
89-
// How the window is split when in half screen mode (i.e. after hitting '+' once).
89+
// How the window is split when in half panel-size mode (i.e. after hitting '+' once).
9090
// Possible values:
9191
// - 'left': split the window horizontally (side panel on the left, main view on the right)
9292
// - 'top': split the window vertically (side panel on top, main view below)
@@ -150,7 +150,7 @@ type GuiConfig struct {
150150
SplitDiff string `yaml:"splitDiff" jsonschema:"enum=auto,enum=always"`
151151
// Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
152152
// One of: 'normal' (default) | 'half' | 'full'
153-
WindowSize string `yaml:"windowSize" jsonschema:"enum=normal,enum=half,enum=full"`
153+
PanelSize string `yaml:"panelSize" jsonschema:"enum=normal,enum=half,enum=full"`
154154
// Window border style.
155155
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
156156
Border string `yaml:"border" jsonschema:"enum=single,enum=double,enum=rounded,enum=hidden"`
@@ -410,8 +410,8 @@ type KeybindingUniversalConfig struct {
410410
CreatePatchOptionsMenu string `yaml:"createPatchOptionsMenu"`
411411
NextTab string `yaml:"nextTab"`
412412
PrevTab string `yaml:"prevTab"`
413-
NextScreenMode string `yaml:"nextScreenMode"`
414-
PrevScreenMode string `yaml:"prevScreenMode"`
413+
NextPanelSize string `yaml:"nextPanelSize"`
414+
PrevPanelSize string `yaml:"prevPanelSize"`
415415
Undo string `yaml:"undo"`
416416
Redo string `yaml:"redo"`
417417
FilteringMenu string `yaml:"filteringMenu"`
@@ -734,7 +734,7 @@ func GetDefaultConfig() *UserConfig {
734734
CommandLogSize: 8,
735735
SplitDiff: "auto",
736736
SkipRewordInEditorWarning: false,
737-
WindowSize: "normal",
737+
PanelSize: "normal",
738738
Border: "rounded",
739739
AnimateExplosion: true,
740740
PortraitMode: "auto",
@@ -855,8 +855,8 @@ func GetDefaultConfig() *UserConfig {
855855
CreatePatchOptionsMenu: "<c-p>",
856856
NextTab: "]",
857857
PrevTab: "[",
858-
NextScreenMode: "+",
859-
PrevScreenMode: "_",
858+
NextPanelSize: "+",
859+
PrevPanelSize: "_",
860860
Undo: "z",
861861
Redo: "<c-z>",
862862
FilteringMenu: "<c-s>",

pkg/gui/context/branches_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func NewBranchesContext(c *ContextCommon) *BranchesContext {
2828
return presentation.GetBranchListDisplayStrings(
2929
viewModel.GetItems(),
3030
c.State().GetItemOperation,
31-
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
31+
c.State().GetRepoState().GetPanelSize() != types.PANEL_SIZE_NORMAL,
3232
c.Modes().Diffing.Ref,
3333
c.Views().Branches.InnerWidth(),
3434
c.Tr,

pkg/gui/context/local_commits_context.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
5050
c.Model().Branches,
5151
c.Model().CheckedOutBranch,
5252
hasRebaseUpdateRefsConfig,
53-
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
53+
c.State().GetRepoState().GetPanelSize() != types.PANEL_SIZE_NORMAL,
5454
c.Modes().CherryPicking.SelectedHashSet(),
5555
c.Modes().Diffing.Ref,
5656
c.Modes().MarkedBaseCommit.GetHash(),
@@ -77,7 +77,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
7777
Key: LOCAL_COMMITS_CONTEXT_KEY,
7878
Kind: types.SIDE_CONTEXT,
7979
Focusable: true,
80-
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES,
80+
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_PANEL_SIZE_CHANGES,
8181
NeedsRerenderOnHeightChange: true,
8282
})),
8383
ListRenderer: ListRenderer{
@@ -215,7 +215,7 @@ func shouldShowGraph(c *ContextCommon) bool {
215215
case "never":
216216
return false
217217
case "when-maximised":
218-
return c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL
218+
return c.State().GetRepoState().GetPanelSize() != types.PANEL_SIZE_NORMAL
219219
}
220220

221221
log.Fatalf("Unknown value for git.log.showGraph: %s. Expected one of: 'always', 'never', 'when-maximised'", value)

pkg/gui/context/reflog_commits_context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext {
2929
getDisplayStrings := func(_ int, _ int) [][]string {
3030
return presentation.GetReflogCommitListDisplayStrings(
3131
viewModel.GetItems(),
32-
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
32+
c.State().GetRepoState().GetPanelSize() != types.PANEL_SIZE_NORMAL,
3333
c.Modes().CherryPicking.SelectedHashSet(),
3434
c.Modes().Diffing.Ref,
3535
time.Now(),
@@ -48,7 +48,7 @@ func NewReflogCommitsContext(c *ContextCommon) *ReflogCommitsContext {
4848
Key: REFLOG_COMMITS_CONTEXT_KEY,
4949
Kind: types.SIDE_CONTEXT,
5050
Focusable: true,
51-
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES,
51+
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_PANEL_SIZE_CHANGES,
5252
})),
5353
ListRenderer: ListRenderer{
5454
list: viewModel,

pkg/gui/context/sub_commits_context.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func NewSubCommitsContext(
4040

4141
getDisplayStrings := func(startIdx int, endIdx int) [][]string {
4242
// This can happen if a sub-commits view is asked to be rerendered while
43-
// it is invisible; for example when switching screen modes, which
43+
// it is invisible; for example when switching panel size, which
4444
// rerenders all views.
4545
if viewModel.GetRef() == nil {
4646
return [][]string{}
@@ -64,7 +64,7 @@ func NewSubCommitsContext(
6464
branches,
6565
viewModel.GetRef().RefName(),
6666
hasRebaseUpdateRefsConfig,
67-
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
67+
c.State().GetRepoState().GetPanelSize() != types.PANEL_SIZE_NORMAL,
6868
c.Modes().CherryPicking.SelectedHashSet(),
6969
c.Modes().Diffing.Ref,
7070
"",
@@ -121,7 +121,7 @@ func NewSubCommitsContext(
121121
Kind: types.SIDE_CONTEXT,
122122
Focusable: true,
123123
Transient: true,
124-
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES,
124+
NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_PANEL_SIZE_CHANGES,
125125
NeedsRerenderOnHeightChange: true,
126126
})),
127127
ListRenderer: ListRenderer{

0 commit comments

Comments
 (0)