diff --git a/go.mod b/go.mod index f47cc9c3e..f5776edcb 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/integrii/flaggy v1.4.0 github.com/jesseduffield/generics v0.0.0-20250517122708-b0b4a53a6f5c github.com/jesseduffield/go-git/v5 v5.14.1-0.20250407170251-e1a013310ccd - github.com/jesseduffield/gocui v0.3.1-0.20250522064656-07eb9218e08e + github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248 github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e diff --git a/go.sum b/go.sum index e39e9f816..acd5728cd 100644 --- a/go.sum +++ b/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/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/gocui v0.3.1-0.20250522064656-07eb9218e08e h1:NuSXZHAUSo+dSAYArlaDpmKgxVpojuKvNcRkYJcQxkY= -github.com/jesseduffield/gocui v0.3.1-0.20250522064656-07eb9218e08e/go.mod h1:sLIyZ2J42R6idGdtemZzsiR3xY5EF0KsvYEGh3dQv3s= +github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248 h1:kFWTUOjkyuerq8L74MyTnpBvrBxPR4T5GpkOv/gr6/o= +github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248/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/go.mod h1:FSWDLKT0NQpntbDd1H3lbz51fhCVlMzy/J0S6nM727Q= github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY= diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go index 375de3ecc..14f16ee71 100644 --- a/vendor/github.com/jesseduffield/gocui/gui.go +++ b/vendor/github.com/jesseduffield/gocui/gui.go @@ -1232,24 +1232,9 @@ func (g *Gui) draw(v *View) error { if g.Cursor { if curview := g.currentView; curview != nil { - vMaxX, vMaxY := curview.Size() - if curview.cx < 0 { - curview.cx = 0 - } else if curview.cx >= vMaxX { - curview.cx = vMaxX - 1 - } - if curview.cy < 0 { - curview.cy = 0 - } else if curview.cy >= vMaxY { - curview.cy = vMaxY - 1 - } - - gMaxX, gMaxY := g.Size() - cx, cy := curview.x0+curview.cx+1, curview.y0+curview.cy+1 - // This test probably doesn't need to be here. - // tcell is hiding cursor by setting coordinates outside of screen. - // Keeping it here for now, as I'm not 100% sure :) - if cx >= 0 && cx < gMaxX && cy >= 0 && cy < gMaxY { + vMaxX, vMaxY := curview.InnerSize() + if curview.cx >= 0 && curview.cx < vMaxX && curview.cy >= 0 && curview.cy < vMaxY { + cx, cy := curview.x0+curview.cx+1, curview.y0+curview.cy+1 Screen.ShowCursor(cx, cy) } else { Screen.HideCursor() diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go index 8c95bbe35..70cbd9735 100644 --- a/vendor/github.com/jesseduffield/gocui/view.go +++ b/vendor/github.com/jesseduffield/gocui/view.go @@ -562,29 +562,19 @@ func max(a, b int) int { } // SetCursor sets the cursor position of the view at the given point, -// relative to the view. It checks if the position is valid. +// relative to the view. It is allowed to set the position to a point outside +// the visible portion of the view, or even outside the content of the view. +// Clients are responsible for clamping to valid positions. func (v *View) SetCursor(x, y int) { - maxX, maxY := v.InnerSize() - if x < 0 || x >= maxX || y < 0 || y >= maxY { - return - } v.cx = x v.cy = y } func (v *View) SetCursorX(x int) { - maxX := v.InnerWidth() - if x < 0 || x >= maxX { - return - } v.cx = x } func (v *View) SetCursorY(y int) { - maxY := v.InnerHeight() - if y < 0 || y >= maxY { - return - } v.cy = y } @@ -1685,10 +1675,11 @@ func (v *View) RenderTextArea() { func updatedCursorAndOrigin(prevOrigin int, size int, cursor int) (int, int) { var newViewCursor int newOrigin := prevOrigin + usableSize := size - 1 - if cursor > prevOrigin+size { - newOrigin = cursor - size - newViewCursor = size + if cursor > prevOrigin+usableSize { + newOrigin = cursor - usableSize + newViewCursor = usableSize } else if cursor < prevOrigin { newOrigin = cursor newViewCursor = 0 diff --git a/vendor/modules.txt b/vendor/modules.txt index 343bc4ac8..f29156732 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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/sync github.com/jesseduffield/go-git/v5/utils/trace -# github.com/jesseduffield/gocui v0.3.1-0.20250522064656-07eb9218e08e +# github.com/jesseduffield/gocui v0.3.1-0.20250529123049-319bd37ff248 ## explicit; go 1.12 github.com/jesseduffield/gocui # github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a