Skip to content

fix(console): accumulate fractional lines in mobile touch scroll (fixes #221, #230) - #232

Merged
NaysKutzu merged 1 commit into
MythicalLTD:developfrom
Crackhead-gsk:fix/mobile-console-touch-scroll-fractional-loss
Sep 19, 2026
Merged

NaysKutzu merged 1 commit into
MythicalLTD:developfrom
Crackhead-gsk:fix/mobile-console-touch-scroll-fractional-loss

Conversation

@Crackhead-gsk

@Crackhead-gsk Crackhead-gsk commented Sep 19, 2026 •

Copy link
Copy Markdown

Fixes #221, fixes #230.

Root cause

xterm v6 only wires mouse-wheel scrolling natively, so ServerTerminal.tsx maps touch pans onto terminal.scrollLines(-dy / cellHeight), called fresh on every touchmove event.

For small/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. The remainder resets on touchstart so a new gesture starts clean.

Testing

  • pnpm exec tsc --noEmit: clean, no new type errors
  • ESLint on the changed file: clean
  • Did not run a full next build against 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

  • Bug Fixes
    • Improved touch scrolling in the server terminal by preserving small finger movements and applying scrolling only after a complete line’s movement is reached.

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

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: MythicalLTD/FeatherPanel/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 71e970fa-0d8c-4036-8073-56937eccfc34

📥 Commits

Reviewing files that changed from the base of the PR and between 31e26d4 and fb53cbc.

📒 Files selected for processing (1)
  • frontendv2/src/components/server/ServerTerminal.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

ServerTerminal now accumulates fractional touch movement between touchmove events. Each gesture resets the remainder, and scrolling occurs only for complete lines.

Changes

Mobile terminal scrolling

Layer / File(s) Summary
Touch-scroll accumulation
frontendv2/src/components/server/ServerTerminal.tsx
The terminal stores fractional movement, resets it when a touch starts, and converts accumulated movement into whole-line scrolling.

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the mobile touch-scrolling fix and the accumulation of fractional lines. It also references the related issues.
Linked Issues check ✅ Passed The change in frontendv2/src/components/server/ServerTerminal.tsx directly addresses [#221] and [#230]. It resets the touch remainder on touchstart, accumulates fractional movement across `touchmo…
Out of Scope Changes check ✅ Passed The reviewed change is limited to touch-scroll handling in ServerTerminal.tsx. The change supports the linked console-scrolling objectives. No unrelated product behavior or unrelated file change app…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NaysKutzu

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@NaysKutzu
NaysKutzu merged commit fde24d9 into MythicalLTD:develop Sep 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants