mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
Update gocui fork
This commit is contained in:
parent
cd4063c763
commit
eff931a138
2
Gopkg.lock
generated
2
Gopkg.lock
generated
@ -77,7 +77,7 @@
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/jesseduffield/gocui"
|
name = "github.com/jesseduffield/gocui"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "432b7f6215f81ef1aaa1b2d9b69887822923cf79"
|
revision = "76a959bb4b0df223fd046b96b68f0162dd609e4b"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/kevinburke/ssh_config"
|
name = "github.com/kevinburke/ssh_config"
|
||||||
|
26
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
26
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -653,17 +653,31 @@ func (g *Gui) onKey(ev *termbox.Event) error {
|
|||||||
// execKeybindings executes the keybinding handlers that match the passed view
|
// execKeybindings executes the keybinding handlers that match the passed view
|
||||||
// and event. The value of matched is true if there is a match and no errors.
|
// and event. The value of matched is true if there is a match and no errors.
|
||||||
func (g *Gui) execKeybindings(v *View, ev *termbox.Event) (matched bool, err error) {
|
func (g *Gui) execKeybindings(v *View, ev *termbox.Event) (matched bool, err error) {
|
||||||
matched = false
|
var globalKb *keybinding
|
||||||
for _, kb := range g.keybindings {
|
for _, kb := range g.keybindings {
|
||||||
if kb.handler == nil {
|
if kb.handler == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) && kb.matchView(v) {
|
if !kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if kb.matchView(v) {
|
||||||
|
return g.execKeybinding(v, kb)
|
||||||
|
}
|
||||||
|
if kb.viewName == "" {
|
||||||
|
globalKb = kb
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if globalKb != nil {
|
||||||
|
return g.execKeybinding(v, globalKb)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// execKeybinding executes a given keybinding
|
||||||
|
func (g *Gui) execKeybinding(v *View, kb *keybinding) (bool, error) {
|
||||||
if err := kb.handler(g, v); err != nil {
|
if err := kb.handler(g, v); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
matched = true
|
return true, nil
|
||||||
}
|
|
||||||
}
|
|
||||||
return matched, nil
|
|
||||||
}
|
}
|
||||||
|
3
vendor/github.com/jesseduffield/gocui/keybinding.go
generated
vendored
3
vendor/github.com/jesseduffield/gocui/keybinding.go
generated
vendored
@ -38,9 +38,6 @@ func (kb *keybinding) matchView(v *View) bool {
|
|||||||
if v.Editable == true && kb.ch != 0 {
|
if v.Editable == true && kb.ch != 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if kb.viewName == "" {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return v != nil && kb.viewName == v.name
|
return v != nil && kb.viewName == v.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user