mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 04:55:58 +03:00
[GH-ISSUE #812] Mouse scroll events lost in bottom portion of terminal after shrinking window #991
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#991
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sbbae0318 on GitHub (Mar 14, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/812
Bug
When a terminal is resized from a wider layout to a narrower (but taller) one, mouse wheel scroll events stop working for any row beyond the original terminal height. Scrolling in the upper portion of the screen still works. The split is deterministic based on the Y coordinate of the mouse cursor.
For example: start at 160x50, resize to 60x100. Scroll events at rows 0-49 work fine. Scroll events at rows 50-99 are silently dropped.
If the application is started in the narrow terminal from the beginning (no resize), scrolling works everywhere as expected.
Root cause
In
packages/core/src/zig/renderer.zig, theresizefunction only updateshitGridWidthandhitGridHeightwhen the new grid needs a larger backing buffer:When the total cell count shrinks (e.g. 16050=8000 -> 60100=6000), the condition is false, so
hitGridWidth/hitGridHeightkeep their old values.checkHitthen rejects any coordinate beyond the stale bounds:With no hit target, the scroll event in
renderer.tsfalls back to the focused renderable (typically the input prompt, not the scrollbox), so scroll doesn't happen.Reproduction
Confirmed with OpenCode over Windows Terminal -> SSH -> tmux.
Environment
Fix
PR coming -- move
hitGridWidth/hitGridHeightassignment out of theifblock so dimensions are always updated. The backing buffer is already large enough (it was allocated for the bigger size), so this is safe.