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.ts b/src/lib/terminalConstants.ts index bf1b8e026..acd6f217e 100644 --- a/src/lib/terminalConstants.ts +++ b/src/lib/terminalConstants.ts @@ -1,6 +1,12 @@ // 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: 10_000, + scrollSensitivity: 2, +} as const; // Pre-computed base64 lookup table — avoids atob() intermediate string allocation. const B64_LOOKUP = new Uint8Array(128); 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,