mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Add config option to disable tab switching with jump keys
This commit is contained in:
parent
7edf629eeb
commit
8da43af924
7 changed files with 44 additions and 3 deletions
|
@ -252,6 +252,9 @@ gui:
|
||||||
# If true, jump to the Files panel after applying a stash
|
# If true, jump to the Files panel after applying a stash
|
||||||
switchToFilesAfterStashApply: true
|
switchToFilesAfterStashApply: true
|
||||||
|
|
||||||
|
# If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead
|
||||||
|
switchTabsWithPanelJumpKeys: false
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -165,6 +165,8 @@ type GuiConfig struct {
|
||||||
SwitchToFilesAfterStashPop bool `yaml:"switchToFilesAfterStashPop"`
|
SwitchToFilesAfterStashPop bool `yaml:"switchToFilesAfterStashPop"`
|
||||||
// If true, jump to the Files panel after applying a stash
|
// If true, jump to the Files panel after applying a stash
|
||||||
SwitchToFilesAfterStashApply bool `yaml:"switchToFilesAfterStashApply"`
|
SwitchToFilesAfterStashApply bool `yaml:"switchToFilesAfterStashApply"`
|
||||||
|
// If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead
|
||||||
|
SwitchTabsWithPanelJumpKeys bool `yaml:"switchTabsWithPanelJumpKeys"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GuiConfig) UseFuzzySearch() bool {
|
func (c *GuiConfig) UseFuzzySearch() bool {
|
||||||
|
@ -736,6 +738,7 @@ func GetDefaultConfig() *UserConfig {
|
||||||
StatusPanelView: "dashboard",
|
StatusPanelView: "dashboard",
|
||||||
SwitchToFilesAfterStashPop: true,
|
SwitchToFilesAfterStashPop: true,
|
||||||
SwitchToFilesAfterStashApply: true,
|
SwitchToFilesAfterStashApply: true,
|
||||||
|
SwitchTabsWithPanelJumpKeys: false,
|
||||||
},
|
},
|
||||||
Git: GitConfig{
|
Git: GitConfig{
|
||||||
Paging: PagingConfig{
|
Paging: PagingConfig{
|
||||||
|
|
|
@ -49,7 +49,8 @@ func (self *JumpToSideWindowController) GetKeybindings(opts types.KeybindingsOpt
|
||||||
|
|
||||||
func (self *JumpToSideWindowController) goToSideWindow(window string) func() error {
|
func (self *JumpToSideWindowController) goToSideWindow(window string) func() error {
|
||||||
return func() error {
|
return func() error {
|
||||||
if self.c.Helpers().Window.CurrentWindow() == window {
|
sideWindowAlreadyActive := self.c.Helpers().Window.CurrentWindow() == window
|
||||||
|
if sideWindowAlreadyActive && self.c.UserConfig().Gui.SwitchTabsWithPanelJumpKeys {
|
||||||
return self.nextTabFunc()
|
return self.nextTabFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,6 +346,7 @@ var tests = []*components.IntegrationTest{
|
||||||
tag.ForceTagLightweight,
|
tag.ForceTagLightweight,
|
||||||
tag.Reset,
|
tag.Reset,
|
||||||
ui.Accordion,
|
ui.Accordion,
|
||||||
|
ui.DisableSwitchTabWithPanelJumpKeys,
|
||||||
ui.DoublePopup,
|
ui.DoublePopup,
|
||||||
ui.EmptyMenu,
|
ui.EmptyMenu,
|
||||||
ui.KeybindingSuggestionsWhenSwitchingRepos,
|
ui.KeybindingSuggestionsWhenSwitchingRepos,
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package ui
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var DisableSwitchTabWithPanelJumpKeys = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Verify that the tab does not change by default when jumping to an already focused panel",
|
||||||
|
ExtraCmdArgs: []string{},
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.Views().Status().Focus().
|
||||||
|
Press(keys.Universal.JumpToBlock[1])
|
||||||
|
t.Views().Files().IsFocused().
|
||||||
|
Press(keys.Universal.JumpToBlock[1])
|
||||||
|
|
||||||
|
// Despite jumping to an already focused panel,
|
||||||
|
// the tab should not change from the base files view
|
||||||
|
t.Views().Files().IsFocused()
|
||||||
|
},
|
||||||
|
})
|
|
@ -6,10 +6,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var SwitchTabWithPanelJumpKeys = NewIntegrationTest(NewIntegrationTestArgs{
|
var SwitchTabWithPanelJumpKeys = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
Description: "Switch tab with the panel jump keys",
|
Description: "Switch tab with the panel jump keys after enabling the feature",
|
||||||
ExtraCmdArgs: []string{},
|
ExtraCmdArgs: []string{},
|
||||||
Skip: false,
|
Skip: false,
|
||||||
SetupConfig: func(config *config.AppConfig) {},
|
SetupConfig: func(config *config.AppConfig) {
|
||||||
|
config.GetUserConfig().Gui.SwitchTabsWithPanelJumpKeys = true
|
||||||
|
},
|
||||||
SetupRepo: func(shell *Shell) {
|
SetupRepo: func(shell *Shell) {
|
||||||
},
|
},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
|
|
@ -462,6 +462,11 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "If true, jump to the Files panel after applying a stash",
|
"description": "If true, jump to the Files panel after applying a stash",
|
||||||
"default": true
|
"default": true
|
||||||
|
},
|
||||||
|
"switchTabsWithPanelJumpKeys": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue