1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

prioritise keybindings on editors

This commit is contained in:
Jesse Duffield
2021-02-18 19:39:33 +11:00
parent 4b1da0cf3c
commit 5d0cf3d919
59 changed files with 328 additions and 100 deletions

View File

@ -1004,16 +1004,17 @@ func (g *Gui) draw(v *View) error {
func (g *Gui) onKey(ev *GocuiEvent) error {
switch ev.Type {
case eventKey:
matched, err := g.execKeybindings(g.currentView, ev)
if g.currentView != nil && g.currentView.Editable && g.currentView.Editor != nil {
matched := g.currentView.Editor.Edit(g.currentView, Key(ev.Key), ev.Ch, Modifier(ev.Mod))
if matched {
break
}
}
_, err := g.execKeybindings(g.currentView, ev)
if err != nil {
return err
}
if matched {
break
}
if g.currentView != nil && g.currentView.Editable && g.currentView.Editor != nil {
g.currentView.Editor.Edit(g.currentView, Key(ev.Key), ev.Ch, Modifier(ev.Mod))
}
case eventMouse:
mx, my := ev.MouseX, ev.MouseY
v, err := g.ViewByPosition(mx, my)