Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return-alt1 to allow for a secondary Return key #3750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ keybinding:
quit: q
quit-alt1: <c-c>
return: <esc>
# When set to a printable character, this will work for returning from non-prompt panels
return-alt1: null
quitWithoutChangingDirectory: Q
togglePanel: <tab>
prevItem: <up>
Expand Down
1 change: 1 addition & 0 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ type KeybindingUniversalConfig struct {
Quit string `yaml:"quit"`
QuitAlt1 string `yaml:"quit-alt1"`
Return string `yaml:"return"`
ReturnAlt1 string `yaml:"return-alt1"`
QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"`
TogglePanel string `yaml:"togglePanel"`
PrevItem string `yaml:"prevItem"`
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/commit_description_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOp
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: self.close,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.close,
},
{
Key: opts.GetKey(opts.Config.Universal.ConfirmInEditor),
Handler: self.confirm,
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/confirmation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.CloseCancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: func() error {
Expand Down
5 changes: 5 additions & 0 deletions pkg/gui/controllers/global_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
Description: self.c.Tr.Cancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Modifier: gocui.ModNone,
Handler: self.escape,
},
{
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
Handler: self.toggleWhitespace,
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/menu_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types.
Description: self.c.Tr.Close,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.close,
},
}

return bindings
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/merge_conflicts_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts)
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}

return bindings
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/patch_building_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts)
Handler: self.Escape,
Description: self.c.Tr.ExitCustomPatchBuilder,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/gui/controllers/search_prompt_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func (self *SearchPromptController) GetKeybindings(opts types.KeybindingsOpts) [
Modifier: gocui.ModNone,
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Modifier: gocui.ModNone,
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Modifier: gocui.ModNone,
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/snake_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (self *SnakeController) GetKeybindings(opts types.KeybindingsOpts) []*types
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: self.Escape,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}

return bindings
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/staging_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: self.TogglePanel,
Expand Down
4 changes: 4 additions & 0 deletions pkg/gui/controllers/suggestions_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: self.switchToConfirmation,
Expand Down