fix(tui): clamp diff scroll offset to last full page

The diff overlay incremented diffScrollOffset on every down-key with no
upper bound; the render clamped only the displayed offset, so the stored
value grew unbounded and the up-key appeared dead for N presses. Clamp
the increment against a new diffMaxScroll() (len(lines) - body height),
shared with the render path via diffBodyHeight().
This commit is contained in:
2026-06-02 23:39:38 +04:00
parent 1017bfffef
commit 6956102cf7
2 changed files with 25 additions and 7 deletions
+3 -1
View File
@@ -332,7 +332,9 @@ func (m Model) handleOverlayKey(k tea.KeyMsg) (tea.Model, tea.Cmd) {
m.diffScrollOffset--
}
case k.Type == tea.KeyDown || runeIs(k, "j"):
m.diffScrollOffset++
if m.diffScrollOffset < m.diffMaxScroll() {
m.diffScrollOffset++
}
case k.Type == tea.KeyCtrlX:
m.overlay = OverlayNone
}