mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Allow switching between commit message and description by clicking
It is annoying to have to tab to the description first before you can set the cursor there by clicking.
This commit is contained in:
@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
||||
@ -58,6 +59,16 @@ func (self *CommitMessageController) GetKeybindings(opts types.KeybindingsOpts)
|
||||
return bindings
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
|
||||
return []*gocui.ViewMouseBinding{
|
||||
{
|
||||
ViewName: self.Context().GetViewName(),
|
||||
Key: gocui.MouseLeft,
|
||||
Handler: self.onClick,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts) error {
|
||||
return func(types.OnFocusLostOpts) error {
|
||||
self.context().RenderCommitLength()
|
||||
@ -137,3 +148,12 @@ func (self *CommitMessageController) openCommitMenu() error {
|
||||
authorSuggestion := self.c.Helpers().Suggestions.GetAuthorsSuggestionsFunc()
|
||||
return self.c.Helpers().Commits.OpenCommitMenu(authorSuggestion)
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) onClick(opts gocui.ViewMouseBindingOpts) error {
|
||||
// Activate the commit message panel when the commit description panel is currently active
|
||||
if self.c.Context().Current().GetKey() == context.COMMIT_DESCRIPTION_CONTEXT_KEY {
|
||||
return self.c.Context().Replace(self.c.Contexts().CommitMessage)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user