From 100e4271e585dda83cb2165245cfdfcb66056486 Mon Sep 17 00:00:00 2001 From: Liang Hu Date: Sun, 9 Aug 2026 16:10:11 -0400 Subject: [PATCH 1/3] fix(terminal): increase wheel scroll sensitivity --- src/components/TerminalView.tsx | 4 ++-- src/lib/terminalConstants.test.ts | 13 +++++++++++++ src/lib/terminalConstants.ts | 6 ++++++ src/remote/AgentDetail.tsx | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/lib/terminalConstants.test.ts diff --git a/src/components/TerminalView.tsx b/src/components/TerminalView.tsx index 01eda0a77..f115816ff 100644 --- a/src/components/TerminalView.tsx +++ b/src/components/TerminalView.tsx @@ -9,7 +9,7 @@ import { TerminalBookmarkGutter } from './TerminalBookmarks'; import { invoke, fireAndForget, Channel } from '../lib/ipc'; import { IPC } from '../../electron/ipc/channels'; import { getTerminalFontFamily } from '../lib/fonts'; -import { TERMINAL_SCROLLBACK_LINES, base64ToUint8Array } from '../lib/terminalConstants'; +import { TERMINAL_SCROLL_OPTIONS, base64ToUint8Array } from '../lib/terminalConstants'; import { getTerminalSearchDecorations, getTerminalTheme, @@ -418,7 +418,7 @@ export function TerminalView(props: TerminalViewProps) { fontFamily: getTerminalFontFamily(store.terminalFont), theme: activeTerminalTheme(), allowProposedApi: true, - scrollback: TERMINAL_SCROLLBACK_LINES, + ...TERMINAL_SCROLL_OPTIONS, disableStdin: taskPtyDetached(), linkHandler: { activate: openTerminalHttpLinkWithModifier, diff --git a/src/lib/terminalConstants.test.ts b/src/lib/terminalConstants.test.ts new file mode 100644 index 000000000..73fb73af6 --- /dev/null +++ b/src/lib/terminalConstants.test.ts @@ -0,0 +1,13 @@ +import { describe, expect, it } from 'vitest'; + +import { TERMINAL_SCROLL_OPTIONS } from './terminalConstants'; + +describe('terminal scroll options', () => { + it('uses practical defaults for normal and accelerated wheel scrolling', () => { + expect(TERMINAL_SCROLL_OPTIONS).toEqual({ + scrollback: 10_000, + scrollSensitivity: 4, + fastScrollSensitivity: 5, + }); + }); +}); diff --git a/src/lib/terminalConstants.ts b/src/lib/terminalConstants.ts index bf1b8e026..eef18b3df 100644 --- a/src/lib/terminalConstants.ts +++ b/src/lib/terminalConstants.ts @@ -2,6 +2,12 @@ // without turning xterm into a memory landfill. export const TERMINAL_SCROLLBACK_LINES = 10_000; +export const TERMINAL_SCROLL_OPTIONS = { + scrollback: TERMINAL_SCROLLBACK_LINES, + scrollSensitivity: 4, + fastScrollSensitivity: 5, +} as const; + // Pre-computed base64 lookup table — avoids atob() intermediate string allocation. const B64_LOOKUP = new Uint8Array(128); for (let i = 0; i < 64; i++) { diff --git a/src/remote/AgentDetail.tsx b/src/remote/AgentDetail.tsx index e8a5defe2..c039f60ab 100644 --- a/src/remote/AgentDetail.tsx +++ b/src/remote/AgentDetail.tsx @@ -1,7 +1,7 @@ import { onMount, onCleanup, createSignal, createEffect, untrack, Show, For } from 'solid-js'; import { Terminal } from '@xterm/xterm'; import { FitAddon } from '@xterm/addon-fit'; -import { TERMINAL_SCROLLBACK_LINES, base64ToUint8Array } from '../lib/terminalConstants'; +import { TERMINAL_SCROLL_OPTIONS, base64ToUint8Array } from '../lib/terminalConstants'; import { createTerminalHttpLinkHandler } from '../lib/terminalLinks'; import { fetchNotes, saveNotes } from './api'; import { agentStatusDisplay } from './attention'; @@ -209,7 +209,7 @@ export function AgentDetail(props: AgentDetailProps) { fontSize: 10, fontFamily: TERM_FONT_FAMILY, theme: { background: '#0b0f14' }, - scrollback: TERMINAL_SCROLLBACK_LINES, + ...TERMINAL_SCROLL_OPTIONS, cursorBlink: false, disableStdin: true, convertEol: false, From a957eb5993333d6f43e8a110bf1b92b2e43b4be8 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 14 Aug 2026 13:07:51 +0200 Subject: [PATCH 2/3] chore(terminal): drop no-op fastScrollSensitivity and constant test fastScrollSensitivity: 5 is already xterm's default, so setting it was a no-op; Alt-scroll compounds with scrollSensitivity to 20 lines per notch either way. Inline TERMINAL_SCROLLBACK_LINES, which no longer had any consumer outside this file, and drop the test that only restated the constant's literal value. --- src/lib/terminalConstants.test.ts | 13 ------------- src/lib/terminalConstants.ts | 8 ++++---- 2 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 src/lib/terminalConstants.test.ts diff --git a/src/lib/terminalConstants.test.ts b/src/lib/terminalConstants.test.ts deleted file mode 100644 index 73fb73af6..000000000 --- a/src/lib/terminalConstants.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -import { TERMINAL_SCROLL_OPTIONS } from './terminalConstants'; - -describe('terminal scroll options', () => { - it('uses practical defaults for normal and accelerated wheel scrolling', () => { - expect(TERMINAL_SCROLL_OPTIONS).toEqual({ - scrollback: 10_000, - scrollSensitivity: 4, - fastScrollSensitivity: 5, - }); - }); -}); diff --git a/src/lib/terminalConstants.ts b/src/lib/terminalConstants.ts index eef18b3df..98fd237f8 100644 --- a/src/lib/terminalConstants.ts +++ b/src/lib/terminalConstants.ts @@ -1,11 +1,11 @@ // Keep substantially more terminal history available for agent review/debugging // without turning xterm into a memory landfill. -export const TERMINAL_SCROLLBACK_LINES = 10_000; - +// xterm defaults scrollSensitivity to 1 line per wheel notch, which makes scrolling +// back through agent output painfully slow. Alt-scroll multiplies this again by +// xterm's fastScrollSensitivity default of 5, so we leave that one alone. export const TERMINAL_SCROLL_OPTIONS = { - scrollback: TERMINAL_SCROLLBACK_LINES, + scrollback: 10_000, scrollSensitivity: 4, - fastScrollSensitivity: 5, } as const; // Pre-computed base64 lookup table — avoids atob() intermediate string allocation. From 238abb71eb03f98abf6e7f5c5a94f02f2f61f6fb Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 14 Aug 2026 13:16:20 +0200 Subject: [PATCH 3/3] fix(terminal): lower scroll sensitivity to 2 after testing 4 lines per wheel notch overshoots badly on a normal mouse; 2 is a comfortable middle between xterm's default of 1 and the 3-5 range requested in #254. Wheel resolution varies enough between devices that a tunable setting is the real fix - #254 stays open for that. --- src/lib/terminalConstants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/terminalConstants.ts b/src/lib/terminalConstants.ts index 98fd237f8..acd6f217e 100644 --- a/src/lib/terminalConstants.ts +++ b/src/lib/terminalConstants.ts @@ -5,7 +5,7 @@ // xterm's fastScrollSensitivity default of 5, so we leave that one alone. export const TERMINAL_SCROLL_OPTIONS = { scrollback: 10_000, - scrollSensitivity: 4, + scrollSensitivity: 2, } as const; // Pre-computed base64 lookup table — avoids atob() intermediate string allocation.