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:
2
go.mod
2
go.mod
@ -15,7 +15,7 @@ require (
|
|||||||
github.com/integrii/flaggy v1.4.0
|
github.com/integrii/flaggy v1.4.0
|
||||||
github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c
|
github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c
|
||||||
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd
|
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248
|
github.com/jesseduffield/gocui v0.3.1-0.20250605111917-fc5387961412
|
||||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
||||||
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
|
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
|
||||||
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
|
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
|
||||||
|
4
go.sum
4
go.sum
@ -194,8 +194,8 @@ github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c h1:tC2Paiis
|
|||||||
github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c/go.mod h1:F2fEBk0ddf6ixrBrJjY7phfQ3hL9rXG0uSjvwYe50bE=
|
github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c/go.mod h1:F2fEBk0ddf6ixrBrJjY7phfQ3hL9rXG0uSjvwYe50bE=
|
||||||
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd h1:ViKj6qth8FgcIWizn9KiACWwPemWSymx62OPN0tHT+Q=
|
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd h1:ViKj6qth8FgcIWizn9KiACWwPemWSymx62OPN0tHT+Q=
|
||||||
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd/go.mod h1:lRhCiBr6XjQrvcQVa+UYsy/99d3wMXn/a0nSQlhnhlA=
|
github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd/go.mod h1:lRhCiBr6XjQrvcQVa+UYsy/99d3wMXn/a0nSQlhnhlA=
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248 h1:kFWTUOjkyuerq8L74MyTnpBvrBxPR4T5GpkOv/gr6/o=
|
github.com/jesseduffield/gocui v0.3.1-0.20250605111917-fc5387961412 h1:8z1CpdCy9nzdj47lSLbDbCVmR5MgXsknYsuuHpzYk5M=
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248/go.mod h1:sLIyZ2J42R6idGdtemZzsiR3xY5EF0KsvYEGh3dQv3s=
|
github.com/jesseduffield/gocui v0.3.1-0.20250605111917-fc5387961412/go.mod h1:sLIyZ2J42R6idGdtemZzsiR3xY5EF0KsvYEGh3dQv3s=
|
||||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a h1:UDeJ3EBk04bXDLOPvuqM3on8HvyJfISw0+UMqW+0a4g=
|
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a h1:UDeJ3EBk04bXDLOPvuqM3on8HvyJfISw0+UMqW+0a4g=
|
||||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a/go.mod h1:FSWDLKT0NQpntbDd1H3lbz51fhCVlMzy/J0S6nM727Q=
|
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a/go.mod h1:FSWDLKT0NQpntbDd1H3lbz51fhCVlMzy/J0S6nM727Q=
|
||||||
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY=
|
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY=
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package gui
|
package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -121,7 +123,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err := setViewFromDimensions(context)
|
_, err := setViewFromDimensions(context)
|
||||||
if err != nil && !gocui.IsUnknownView(err) {
|
if err != nil && !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,7 +136,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||||||
|
|
||||||
for _, context := range gui.transientContexts() {
|
for _, context := range gui.transientContexts() {
|
||||||
view, err := gui.g.View(context.GetViewName())
|
view, err := gui.g.View(context.GetViewName())
|
||||||
if err != nil && !gocui.IsUnknownView(err) {
|
if err != nil && !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
view.Visible = gui.helpers.Window.GetViewNameForWindow(context.GetWindowName()) == context.GetViewName()
|
view.Visible = gui.helpers.Window.GetViewNameForWindow(context.GetWindowName()) == context.GetViewName()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package gui
|
package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
@ -78,7 +79,7 @@ func (gui *Gui) createAllViews() error {
|
|||||||
var err error
|
var err error
|
||||||
for _, mapping := range gui.orderedViewNameMappings() {
|
for _, mapping := range gui.orderedViewNameMappings() {
|
||||||
*mapping.viewPtr, err = gui.prepareView(mapping.name)
|
*mapping.viewPtr, err = gui.prepareView(mapping.name)
|
||||||
if err != nil && !gocui.IsUnknownView(err) {
|
if err != nil && !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package clients
|
package clients
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -314,7 +315,7 @@ func (self *app) layout(g *gocui.Gui) error {
|
|||||||
g.FgColor = gocui.ColorGreen
|
g.FgColor = gocui.ColorGreen
|
||||||
listView, err := g.SetView("list", 0, 0, maxX-1, maxY-descriptionViewHeight-keybindingsViewHeight-editorViewHeight-1, 0)
|
listView, err := g.SetView("list", 0, 0, maxX-1, maxY-descriptionViewHeight-keybindingsViewHeight-editorViewHeight-1, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !gocui.IsUnknownView(err) {
|
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +335,7 @@ func (self *app) layout(g *gocui.Gui) error {
|
|||||||
|
|
||||||
descriptionView, err := g.SetViewBeneath("description", "list", descriptionViewHeight)
|
descriptionView, err := g.SetViewBeneath("description", "list", descriptionViewHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !gocui.IsUnknownView(err) {
|
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
descriptionView.Title = "Test description"
|
descriptionView.Title = "Test description"
|
||||||
@ -344,7 +345,7 @@ func (self *app) layout(g *gocui.Gui) error {
|
|||||||
|
|
||||||
keybindingsView, err := g.SetViewBeneath("keybindings", "description", keybindingsViewHeight)
|
keybindingsView, err := g.SetViewBeneath("keybindings", "description", keybindingsViewHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !gocui.IsUnknownView(err) {
|
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
keybindingsView.Title = "Keybindings"
|
keybindingsView.Title = "Keybindings"
|
||||||
@ -355,7 +356,7 @@ func (self *app) layout(g *gocui.Gui) error {
|
|||||||
|
|
||||||
editorView, err := g.SetViewBeneath("editor", "keybindings", editorViewHeight)
|
editorView, err := g.SetViewBeneath("editor", "keybindings", editorViewHeight)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !gocui.IsUnknownView(err) {
|
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
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)
|
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 {
|
for _, kb := range g.keybindings {
|
||||||
if kb.handler == nil {
|
if kb.handler == nil {
|
||||||
continue
|
continue
|
||||||
@ -1506,13 +1508,13 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if g.matchView(v, kb) {
|
if g.matchView(v, kb) {
|
||||||
err := g.execKeybinding(v, kb)
|
err = g.execKeybinding(v, kb)
|
||||||
if IsKeybindingNotHandled(err) {
|
if !errors.Is(err, ErrKeybindingNotHandled) {
|
||||||
matchingParentViewKb = nil
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matchingParentViewKb = nil
|
||||||
|
break
|
||||||
}
|
}
|
||||||
if v != nil && g.matchView(v.ParentView, kb) {
|
if v != nil && g.matchView(v.ParentView, kb) {
|
||||||
matchingParentViewKb = kb
|
matchingParentViewKb = kb
|
||||||
@ -1522,8 +1524,8 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if matchingParentViewKb != nil {
|
if matchingParentViewKb != nil {
|
||||||
err := g.execKeybinding(v.ParentView, matchingParentViewKb)
|
err = g.execKeybinding(v.ParentView, matchingParentViewKb)
|
||||||
if !IsKeybindingNotHandled(err) {
|
if !errors.Is(err, ErrKeybindingNotHandled) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1536,9 +1538,9 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if globalKb != nil {
|
if globalKb != nil {
|
||||||
return g.execKeybinding(v, globalKb)
|
err = g.execKeybinding(v, globalKb)
|
||||||
}
|
}
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// execKeybinding executes a given keybinding
|
// execKeybinding executes a given keybinding
|
||||||
@ -1602,20 +1604,6 @@ func (g *Gui) isBlacklisted(k Key) bool {
|
|||||||
return false
|
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 {
|
func (g *Gui) Suspend() error {
|
||||||
g.suspendedMutex.Lock()
|
g.suspendedMutex.Lock()
|
||||||
defer g.suspendedMutex.Unlock()
|
defer g.suspendedMutex.Unlock()
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -227,7 +227,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
|
|||||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
||||||
github.com/jesseduffield/go-git/v5/utils/sync
|
github.com/jesseduffield/go-git/v5/utils/sync
|
||||||
github.com/jesseduffield/go-git/v5/utils/trace
|
github.com/jesseduffield/go-git/v5/utils/trace
|
||||||
# github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248
|
# github.com/jesseduffield/gocui v0.3.1-0.20250605111917-fc5387961412
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/jesseduffield/gocui
|
github.com/jesseduffield/gocui
|
||||||
# github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
# github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
||||||
|
Reference in New Issue
Block a user