mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
Bump gocui and adapt lazygit code
Adaptions are for this gocui commit: Cleanup: remove Is* error functions - Use errors.Is instead of quality comparisons. This is better because it matches wrapped errors as well, which we will need later in this branch. - Inline the errors.Is calls at the call sites. This is idiomatic go, we don't need helper functions for this. See https://go.dev/blog/go1.13-errors for more about this.
This commit is contained in:
36
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
36
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -786,7 +786,7 @@ func (g *Gui) MainLoop() error {
|
||||
}
|
||||
|
||||
func (g *Gui) handleError(err error) error {
|
||||
if err != nil && !IsQuit(err) && g.ErrorHandler != nil {
|
||||
if err != nil && !standardErrors.Is(err, ErrQuit) && g.ErrorHandler != nil {
|
||||
return g.ErrorHandler(err)
|
||||
}
|
||||
|
||||
@ -1498,6 +1498,8 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
for _, kb := range g.keybindings {
|
||||
if kb.handler == nil {
|
||||
continue
|
||||
@ -1506,13 +1508,13 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
||||
continue
|
||||
}
|
||||
if g.matchView(v, kb) {
|
||||
err := g.execKeybinding(v, kb)
|
||||
if IsKeybindingNotHandled(err) {
|
||||
matchingParentViewKb = nil
|
||||
break
|
||||
} else {
|
||||
err = g.execKeybinding(v, kb)
|
||||
if !errors.Is(err, ErrKeybindingNotHandled) {
|
||||
return err
|
||||
}
|
||||
|
||||
matchingParentViewKb = nil
|
||||
break
|
||||
}
|
||||
if v != nil && g.matchView(v.ParentView, kb) {
|
||||
matchingParentViewKb = kb
|
||||
@ -1522,8 +1524,8 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
||||
}
|
||||
}
|
||||
if matchingParentViewKb != nil {
|
||||
err := g.execKeybinding(v.ParentView, matchingParentViewKb)
|
||||
if !IsKeybindingNotHandled(err) {
|
||||
err = g.execKeybinding(v.ParentView, matchingParentViewKb)
|
||||
if !errors.Is(err, ErrKeybindingNotHandled) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -1536,9 +1538,9 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
||||
}
|
||||
|
||||
if globalKb != nil {
|
||||
return g.execKeybinding(v, globalKb)
|
||||
err = g.execKeybinding(v, globalKb)
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
// execKeybinding executes a given keybinding
|
||||
@ -1602,20 +1604,6 @@ func (g *Gui) isBlacklisted(k Key) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsUnknownView reports whether the contents of an error is "unknown view".
|
||||
func IsUnknownView(err error) bool {
|
||||
return err != nil && err.Error() == ErrUnknownView.Error()
|
||||
}
|
||||
|
||||
// IsQuit reports whether the contents of an error is "quit".
|
||||
func IsQuit(err error) bool {
|
||||
return err != nil && err.Error() == ErrQuit.Error()
|
||||
}
|
||||
|
||||
func IsKeybindingNotHandled(err error) bool {
|
||||
return err != nil && err.Error() == ErrKeybindingNotHandled.Error()
|
||||
}
|
||||
|
||||
func (g *Gui) Suspend() error {
|
||||
g.suspendedMutex.Lock()
|
||||
defer g.suspendedMutex.Unlock()
|
||||
|
Reference in New Issue
Block a user