Skip to content

Commit c67979a

Browse files
authored
Add options for disabling switching to the Files panel after popping or applying a stash (#3913)
- **PR Description** In v0.44.0 we added a small QoL improvement to auto-switch to the Files panel after popping or applying a stash. While this should be an improvement for most people, it turns out to be in the way of some people's workflows, so make it configurable. See [here](#3888 (comment)) for more discussion.
2 parents 647f533 + 0e489bb commit c67979a

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

Diff for: docs/Config.md

+6
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ gui:
246246
# One of 'dashboard' (default) | 'allBranchesLog'
247247
statusPanelView: dashboard
248248

249+
# If true, jump to the Files panel after popping a stash
250+
switchToFilesAfterStashPop: true
251+
252+
# If true, jump to the Files panel after applying a stash
253+
switchToFilesAfterStashApply: true
254+
249255
# Config relating to git
250256
git:
251257
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md

Diff for: pkg/config/user_config.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ type GuiConfig struct {
161161
// Status panel view.
162162
// One of 'dashboard' (default) | 'allBranchesLog'
163163
StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"`
164+
// If true, jump to the Files panel after popping a stash
165+
SwitchToFilesAfterStashPop bool `yaml:"switchToFilesAfterStashPop"`
166+
// If true, jump to the Files panel after applying a stash
167+
SwitchToFilesAfterStashApply bool `yaml:"switchToFilesAfterStashApply"`
164168
}
165169

166170
func (c *GuiConfig) UseFuzzySearch() bool {
@@ -729,7 +733,9 @@ func GetDefaultConfig() *UserConfig {
729733
Frames: []string{"|", "/", "-", "\\"},
730734
Rate: 50,
731735
},
732-
StatusPanelView: "dashboard",
736+
StatusPanelView: "dashboard",
737+
SwitchToFilesAfterStashPop: true,
738+
SwitchToFilesAfterStashApply: true,
733739
},
734740
Git: GitConfig{
735741
Paging: PagingConfig{

Diff for: pkg/gui/controllers/stash_controller.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ func (self *StashController) handleStashApply(stashEntry *models.StashEntry) err
111111
if err != nil {
112112
return err
113113
}
114-
self.c.Context().Push(self.c.Contexts().Files)
114+
if self.c.UserConfig().Gui.SwitchToFilesAfterStashApply {
115+
self.c.Context().Push(self.c.Contexts().Files)
116+
}
115117
return nil
116118
}
117119

@@ -138,7 +140,9 @@ func (self *StashController) handleStashPop(stashEntry *models.StashEntry) error
138140
if err != nil {
139141
return err
140142
}
141-
self.c.Context().Push(self.c.Contexts().Files)
143+
if self.c.UserConfig().Gui.SwitchToFilesAfterStashPop {
144+
self.c.Context().Push(self.c.Contexts().Files)
145+
}
142146
return nil
143147
}
144148

Diff for: schema/config.json

+10
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,16 @@
452452
],
453453
"description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'",
454454
"default": "dashboard"
455+
},
456+
"switchToFilesAfterStashPop": {
457+
"type": "boolean",
458+
"description": "If true, jump to the Files panel after popping a stash",
459+
"default": true
460+
},
461+
"switchToFilesAfterStashApply": {
462+
"type": "boolean",
463+
"description": "If true, jump to the Files panel after applying a stash",
464+
"default": true
455465
}
456466
},
457467
"additionalProperties": false,

0 commit comments

Comments
 (0)