mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-14 09:36:24 -04:00
Press enter in focused main view when user config is on
This commit is contained in:
parent
64cc4ccd32
commit
79f3053f41
|
|
@ -30,6 +30,13 @@ func NewMainViewController(
|
|||
}
|
||||
|
||||
func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
||||
var goIntoDescription string
|
||||
// We only want to show the "enter" menu item if the user config is true;
|
||||
// leaving the description empty causes it to be hidden
|
||||
if self.c.UserConfig().Gui.ShowSelectionInFocusedMainView {
|
||||
goIntoDescription = self.c.Tr.EnterStaging
|
||||
}
|
||||
|
||||
return []*types.Binding{
|
||||
{
|
||||
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
|
||||
|
|
@ -44,6 +51,11 @@ func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*ty
|
|||
Description: self.c.Tr.ExitFocusedMainView,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
|
||||
Handler: self.enter,
|
||||
Description: goIntoDescription,
|
||||
},
|
||||
{
|
||||
// overriding this because we want to read all of the task's output before we start searching
|
||||
Keys: opts.GetKeys(opts.Config.Universal.StartSearch),
|
||||
|
|
@ -88,6 +100,15 @@ func (self *MainViewController) escape() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (self *MainViewController) enter() error {
|
||||
sidePanelContext := self.c.Context().NextInStack(self.context)
|
||||
if sidePanelContext != nil && sidePanelContext.GetOnClickFocusedMainView() != nil {
|
||||
return sidePanelContext.GetOnClickFocusedMainView()(
|
||||
self.context.GetViewName(), self.context.GetView().SelectedLineIdx())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *MainViewController) onClickInAlreadyFocusedView(opts gocui.ViewMouseBindingOpts) error {
|
||||
if self.context.GetView().Highlight && !opts.IsDoubleClick {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -548,6 +548,7 @@ type TranslationSet struct {
|
|||
EmptyPatchError string
|
||||
EnterCommitFile string
|
||||
EnterCommitFileTooltip string
|
||||
EnterStaging string
|
||||
ExitCustomPatchBuilder string
|
||||
ExitFocusedMainView string
|
||||
EnterUpstream string
|
||||
|
|
@ -1712,6 +1713,7 @@ func EnglishTranslationSet() *TranslationSet {
|
|||
EmptyPatchError: "Patch is still empty. Add some files or lines to your patch first.",
|
||||
EnterCommitFile: "Enter file / Toggle directory collapsed",
|
||||
EnterCommitFileTooltip: "If a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory.",
|
||||
EnterStaging: "Enter staging/patch building",
|
||||
ExitCustomPatchBuilder: `Exit custom patch builder`,
|
||||
ExitFocusedMainView: "Exit back to side panel",
|
||||
EnterUpstream: `Enter upstream as '<remote> <branchname>'`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue