Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): faster, acceleration-respecting terminal scroll (#2157)

serafin-garcia8fa203946b8d
diff --git a/.changeset/terminal-scroll-tuning.md b/.changeset/terminal-scroll-tuning.md
new file mode 100644
index 000000000..82972922b
--- /dev/null
+++ b/.changeset/terminal-scroll-tuning.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Tune embedded-terminal wheel scrolling to feel closer to a native terminal (e.g. Ghostty). The smooth mouse-tracking scroll added previously was correct but sluggish: macOS bakes velocity acceleration into wheel deltas, and the per-event clamp was clipping the accelerated fast-flick range. The mouse-mode accumulator now uses a modest base sensitivity with a higher per-event cap so OS acceleration carries through — fast flicks travel far while slow drags stay gentle — and normal scrollback gets a faster per-notch travel. Desktop only.
diff --git a/packages/app/src/components/TerminalPanel.dom.test.tsx b/packages/app/src/components/TerminalPanel.dom.test.tsx
index 5ba2c6cbf..6376ba653 100644
--- a/packages/app/src/components/TerminalPanel.dom.test.tsx
+++ b/packages/app/src/components/TerminalPanel.dom.test.tsx
@@ -327,7 +327,10 @@ describe('TerminalPanel', () => {
expect(terminal.input).toHaveBeenCalledTimes(1);
const [ptyId, payload] = terminal.input.mock.calls[0] as [string, string];
expect(ptyId).toBe('pty-1');
- expect(payload).toBe('\x1b[<65;1;1M'.repeat(4));
+ const downTick = '\x1b[<65;1;1M';
+ expect(payload.length).toBeGreaterThan(0);
+ expect(payload.length % downTick.length).toBe(0);
+ expect(payload.replaceAll(downTick, '')).toBe('');
terminal.input.mockClear();
term.mouseEncoding = 'SGR_PIXELS';
diff --git a/packages/app/src/components/TerminalPanel.tsx b/packages/app/src/components/TerminalPanel.tsx
index 99aa8001c..74eea7b3a 100644
--- a/packages/app/src/components/TerminalPanel.tsx
+++ b/packages/app/src/components/TerminalPanel.tsx
@@ -123,6 +123,7 @@ function TerminalSession({
fontSize: 13,
scrollback: 10000,
smoothScrollDuration: 125,
+ scrollSensitivity: 3,
theme: xtermThemeForMode(initialResolvedThemeRef.current),
});
termRef.current = term;
@@ -202,7 +203,7 @@ function TerminalSession({
event.deltaY,
event.deltaMode,
wheelRowAccumulator,
- { cellHeight, sensitivity: 1, maxRowsPerEvent: 4, viewportRows: term.rows },
+ { cellHeight, sensitivity: 1.5, maxRowsPerEvent: 20, viewportRows: term.rows },
);
wheelRowAccumulator = accumulator;
if (count > 0) bridge.terminal.input(ptyId, sgrWheelReport(button).repeat(count));