Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion backend/internal/adapters/runtime/zellij/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ func attachArgs(id string) []string {
func embeddedClientOptions() []string {
return []string{
"--pane-frames", "false",
"--mouse-mode", "false",
// Mouse mode MUST be on. The terminal runs `zellij attach` in the
// alternate screen buffer, and xterm.js is configured with
// scrollback: 0 (XtermTerminal.tsx), so there is no local scrollback
// to fall back on. With mouse mode off, zellij never enables mouse
// tracking — wheel events reach neither xterm (no buffer) nor zellij
// (no tracking) and scroll is completely dead. Enabling mouse mode
// makes zellij intercept wheel events and scroll its own scrollback.
// Text selection still works via shift-drag (xterm.js built-in bypass).
"--mouse-mode", "true",
"--advanced-mouse-actions", "false",
"--mouse-hover-effects", "false",
"--focus-follows-mouse", "false",
Expand Down
4 changes: 2 additions & 2 deletions backend/internal/adapters/runtime/zellij/zellij_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func containsKey(values []string, key string) bool {
func TestCommandBuilders(t *testing.T) {
embeddedOptions := []string{
"--pane-frames", "false",
"--mouse-mode", "false",
"--mouse-mode", "true",
"--advanced-mouse-actions", "false",
"--mouse-hover-effects", "false",
"--focus-follows-mouse", "false",
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestAttachCommandUsesEmbeddedClientOptions(t *testing.T) {
}
embeddedOptions := []string{
"--pane-frames", "false",
"--mouse-mode", "false",
"--mouse-mode", "true",
"--advanced-mouse-actions", "false",
"--mouse-hover-effects", "false",
"--focus-follows-mouse", "false",
Expand Down
5 changes: 3 additions & 2 deletions backend/internal/terminal/attachment_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func TestAttachmentStreamsRealZellijPane(t *testing.T) {
eventually(t, 5*time.Second, func() bool { return strings.Contains(got.string(), "AO_MARKER_42") })

// A fresh attach must carry zellij's alt-screen init handshake. Mouse
// reporting is deliberately disabled for AO's embedded client, so this test
// should not require SGR mouse mode.
// mode is enabled (--mouse-mode true) so wheel events reach zellij and
// scroll its internal scrollback; the attach enables SGR mouse tracking
// as part of that handshake.
eventually(t, 5*time.Second, func() bool {
out := got.string()
return strings.Contains(out, "\x1b[?1049h")
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/renderer/components/XtermTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ export function XtermTerminal(props: XtermTerminalProps) {
// The mux PTY runs `zellij attach` (backend AttachCommand), a
// full-screen alt-buffer app that owns scrollback itself — same as
// yyork. xterm's own buffer never accumulates history (the alt screen
// doesn't feed scrollback), and wheel events reach zellij as mouse
// reports instead of scrolling locally. 0 also stops FitAddon
// reserving ~14px on the right for a scrollbar that can never appear.
// doesn't feed scrollback). The backend enables zellij mouse mode
// (--mouse-mode true in embeddedClientOptions), so wheel events reach
// zellij as SGR mouse reports and scroll zellij's internal scrollback.
// 0 also stops FitAddon reserving ~14px on the right for a scrollbar
// that can never appear. Text selection still works via shift-drag
// (xterm.js built-in mouse-tracking bypass).
scrollback: 0,
theme: props.theme === "dark" ? terminalThemes.dark : terminalThemes.light,
});
Expand Down
Loading