1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Bump gocui

See https://github.com/jesseduffield/gocui/pull/80.

This fixes selecting hunks in the staging view that are longer than the screen.
This commit is contained in:
Stefan Haller
2025-05-29 14:33:12 +02:00
parent 21b8b2827e
commit 5dbd91038a
5 changed files with 14 additions and 38 deletions

View File

@ -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()

View File

@ -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