fix(console): accumulate fractional lines in mobile touch scroll (fixes #221, #230) - #232
Conversation
MythicalLTD#221, MythicalLTD#230) The touch-pan handler that lets the server console scroll on mobile (xterm v6 only wires mouse-wheel scrolling natively) computed `terminal.scrollLines(-dy / cellHeight)` fresh on every touchmove event. For small or slow finger movements - the common case on a phone - this produces a fractional line count between -1 and 1 (e.g. dy=3px over a ~20px cell height is -0.15 lines). xterm's scrollLines() truncates non-integer input, so slow/careful touch scrolling silently dropped almost every movement: the console felt like it barely scrolled, or on some devices didn't scroll at all. Fix: carry the fractional remainder between touchmove events and only call scrollLines() once the accumulated amount crosses a whole line, so small movements add up instead of being discarded individually. Remainder resets on touchstart so a new gesture starts clean. Verified: - pnpm exec tsc --noEmit: clean, no new type errors - ESLint on the changed file: clean - Full `next build` was not run against the live panel container due to its limited RAM; type-checking and lint are sufficient signal for a change this scoped (touch event math only, no new deps/types)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: MythicalLTD/FeatherPanel/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Walkthrough
ChangesMobile terminal scrolling
Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Fixes #221, fixes #230.
Root cause
xterm v6 only wires mouse-wheel scrolling natively, so
ServerTerminal.tsxmaps touch pans ontoterminal.scrollLines(-dy / cellHeight), called fresh on everytouchmoveevent.For small/slow finger movements - the common case on a phone - this produces a fractional line count between -1 and 1 (e.g.
dy=3pxover a ~20px cell height is-0.15lines). xterm'sscrollLines()truncates non-integer input, so slow/careful touch scrolling silently dropped almost every movement: the console felt like it barely scrolled, or on some devices didn't scroll at all.Fix
Carry the fractional remainder between touchmove events and only call
scrollLines()once the accumulated amount crosses a whole line, so small movements add up instead of being discarded individually. The remainder resets ontouchstartso a new gesture starts clean.Testing
pnpm exec tsc --noEmit: clean, no new type errorsnext buildagainst the live panel container (limited RAM); type-checking and lint are sufficient signal for a change this scoped (touch event math only, no new deps/types)Summary by CodeRabbit