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:
@ -1,6 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
@ -47,6 +49,16 @@ func (self *CommitDescriptionController) Context() types.Context {
|
||||
return self.c.Contexts().CommitDescription
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionController) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
|
||||
return []*gocui.ViewMouseBinding{
|
||||
{
|
||||
ViewName: self.Context().GetViewName(),
|
||||
Key: gocui.MouseLeft,
|
||||
Handler: self.onClick,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionController) switchToCommitMessage() error {
|
||||
return self.c.Context().Replace(self.c.Contexts().CommitMessage)
|
||||
}
|
||||
@ -63,3 +75,12 @@ func (self *CommitDescriptionController) openCommitMenu() error {
|
||||
authorSuggestion := self.c.Helpers().Suggestions.GetAuthorsSuggestionsFunc()
|
||||
return self.c.Helpers().Commits.OpenCommitMenu(authorSuggestion)
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionController) onClick(opts gocui.ViewMouseBindingOpts) error {
|
||||
// Activate the description panel when the commit message panel is currently active
|
||||
if self.c.Context().Current().GetKey() == context.COMMIT_MESSAGE_CONTEXT_KEY {
|
||||
return self.c.Context().Replace(self.c.Contexts().CommitDescription)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user