Skip to content

fix(terminal): enable zellij mouse mode so wheel scroll works#363

Open
i-trytoohard wants to merge 1 commit into
mainfrom
fix/terminal-scroll-zellij-mouse-mode
Open

fix(terminal): enable zellij mouse mode so wheel scroll works#363
i-trytoohard wants to merge 1 commit into
mainfrom
fix/terminal-scroll-zellij-mouse-mode

Conversation

@i-trytoohard

Copy link
Copy Markdown
Collaborator

Problem

Terminal scroll is completely dead — scrolling the wheel does nothing.

Root cause

The terminal runs zellij attach in the alternate screen buffer. The frontend sets scrollback: 0 on xterm.js (XtermTerminal.tsx) because zellij owns scrollback — there is no local buffer to fall back on.

But the backend passed --mouse-mode false in embeddedClientOptions() (commands.go:86), applied to both session creation and every per-client attach. With mouse tracking off, zellij never enables SGR mouse mode. Wheel events reach:

  • xterm.js → nothing (no scrollback buffer, scrollback: 0)
  • zellij → nothing (mouse tracking disabled, events ignored)

Wheel events fall into a void.

Introduced in #325 (5e8c8de) when client options were extracted into embeddedClientOptions(). The integration test even documented the decision: "Mouse reporting is deliberately disabled."

Fix

Set --mouse-mode true. Zellij now enables SGR mouse tracking on attach, so wheel events reach zellij and scroll its internal scrollback.

Text selection still works — xterm.js bypasses mouse tracking for shift-drag by default.

Changes

File Change
backend/.../zellij/commands.go --mouse-mode falsetrue + explanatory comment
backend/.../zellij/zellij_test.go Updated 2 test expectations to match
backend/.../terminal/attachment_integration_test.go Updated stale comment
frontend/.../XtermTerminal.tsx Updated scrollback comment to document the dependency on mouse mode

Testing

  • go test ./internal/adapters/runtime/zellij/
  • go test ./internal/terminal/
  • Full backend suite (go test ./...) — all 36 packages pass, zero regressions

Terminal scroll was completely dead. The frontend configures xterm.js
with scrollback: 0 because zellij owns scrollback in the alt-screen
buffer, but the backend passed --mouse-mode false to every zellij
attach (embeddedClientOptions). With mouse tracking off, zellij never
enabled SGR mouse mode — wheel events reached neither xterm (no local
buffer) nor zellij (no tracking), falling into a void.

Set --mouse-mode true so zellij intercepts wheel events and scrolls
its own scrollback. Text selection still works via shift-drag, which
xterm.js bypasses through mouse tracking by default.

Introduced in #325 (5e8c8de) when client options were extracted into
embeddedClientOptions().
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.

1 participant