mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	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](https://github.com/jesseduffield/lazygit/pull/3888#issuecomment-2350853602) for more discussion.
This commit is contained in:
		| @@ -246,6 +246,12 @@ gui: | |||||||
|   # One of 'dashboard' (default) | 'allBranchesLog' |   # One of 'dashboard' (default) | 'allBranchesLog' | ||||||
|   statusPanelView: dashboard |   statusPanelView: dashboard | ||||||
|  |  | ||||||
|  |   # If true, jump to the Files panel after popping a stash | ||||||
|  |   switchToFilesAfterStashPop: true | ||||||
|  |  | ||||||
|  |   # If true, jump to the Files panel after applying a stash | ||||||
|  |   switchToFilesAfterStashApply: true | ||||||
|  |  | ||||||
| # Config relating to git | # Config relating to git | ||||||
| git: | git: | ||||||
|   # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md |   # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md | ||||||
|   | |||||||
| @@ -161,6 +161,10 @@ type GuiConfig struct { | |||||||
| 	// Status panel view. | 	// Status panel view. | ||||||
| 	// One of 'dashboard' (default) | 'allBranchesLog' | 	// One of 'dashboard' (default) | 'allBranchesLog' | ||||||
| 	StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"` | 	StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"` | ||||||
|  | 	// If true, jump to the Files panel after popping a stash | ||||||
|  | 	SwitchToFilesAfterStashPop bool `yaml:"switchToFilesAfterStashPop"` | ||||||
|  | 	// If true, jump to the Files panel after applying a stash | ||||||
|  | 	SwitchToFilesAfterStashApply bool `yaml:"switchToFilesAfterStashApply"` | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *GuiConfig) UseFuzzySearch() bool { | func (c *GuiConfig) UseFuzzySearch() bool { | ||||||
| @@ -730,6 +734,8 @@ func GetDefaultConfig() *UserConfig { | |||||||
| 				Rate:   50, | 				Rate:   50, | ||||||
| 			}, | 			}, | ||||||
| 			StatusPanelView:              "dashboard", | 			StatusPanelView:              "dashboard", | ||||||
|  | 			SwitchToFilesAfterStashPop:   true, | ||||||
|  | 			SwitchToFilesAfterStashApply: true, | ||||||
| 		}, | 		}, | ||||||
| 		Git: GitConfig{ | 		Git: GitConfig{ | ||||||
| 			Paging: PagingConfig{ | 			Paging: PagingConfig{ | ||||||
|   | |||||||
| @@ -111,7 +111,9 @@ func (self *StashController) handleStashApply(stashEntry *models.StashEntry) err | |||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  | 		if self.c.UserConfig().Gui.SwitchToFilesAfterStashApply { | ||||||
| 			self.c.Context().Push(self.c.Contexts().Files) | 			self.c.Context().Push(self.c.Contexts().Files) | ||||||
|  | 		} | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -138,7 +140,9 @@ func (self *StashController) handleStashPop(stashEntry *models.StashEntry) error | |||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  | 		if self.c.UserConfig().Gui.SwitchToFilesAfterStashPop { | ||||||
| 			self.c.Context().Push(self.c.Contexts().Files) | 			self.c.Context().Push(self.c.Contexts().Files) | ||||||
|  | 		} | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -452,6 +452,16 @@ | |||||||
|           ], |           ], | ||||||
|           "description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'", |           "description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'", | ||||||
|           "default": "dashboard" |           "default": "dashboard" | ||||||
|  |         }, | ||||||
|  |         "switchToFilesAfterStashPop": { | ||||||
|  |           "type": "boolean", | ||||||
|  |           "description": "If true, jump to the Files panel after popping a stash", | ||||||
|  |           "default": true | ||||||
|  |         }, | ||||||
|  |         "switchToFilesAfterStashApply": { | ||||||
|  |           "type": "boolean", | ||||||
|  |           "description": "If true, jump to the Files panel after applying a stash", | ||||||
|  |           "default": true | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       "additionalProperties": false, |       "additionalProperties": false, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user