opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): minimal scroll wheel config + wiring (accel mode, scale, max cap)

Open paulbettner opened this issue 2 months ago • 2 comments

This PR adds a tiny, backwards‑compatible set of TUI scroll wheel settings and wires them into the two ScrollBox usages. Defaults preserve existing behavior.\n\nWhat’s included (minimal diff):\n- Config schema (TUI):\n - : 'linear' | 'mac' (optional)\n - : number (optional, global gain)\n - : number (optional, mac cap)\n- TUI integration (2 places):\n - routes/session/index.tsx — pass configured to main scrollbox\n - ui/dialog-select.tsx — pass configured to dialog scrollbox\n - Implementation is a tiny wrapper: choose Linear/Mac from @opentui/core, optionally pass , then return .\n\nNot included (on purpose):\n- No custom shaping/gating/deadzones\n- No changes to OpenTUI libs\n- No docs changes (can follow existing docs pattern in a follow‑up if preferred)\n\nCompatibility:\n- All fields are optional; when unset, behavior is unchanged (macOS still uses MacOSScrollAccel by default).\n\nRationale:\n- Users on some terminals/machines perceive wheel sensitivity as too high. These three knobs allow per‑user tuning without changing defaults or forking OpenTUI.\n\nFiles touched:\n- packages/opencode/src/config/config.ts\n- packages/opencode/src/cli/cmd/tui/routes/session/index.tsx\n- packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx\n\nHappy to add a short blurb to the config docs if maintainers prefer.

paulbettner avatar Nov 04 '25 06:11 paulbettner

backwards‑compatible set of TUI scroll wheel setting

Hm can u explain what makes this backwards compatible?

rekram1-node avatar Nov 04 '25 07:11 rekram1-node

just meant that this change is purely additive and opt‑in: all three settings are optional and default to a no‑op.

When unset, it constructs the same accelerator with the same defaults (scale=1, no cap), and only threads it into the two existing ScrollBox usages (i.e. no changes to keybinds, event handling, UI)

in other words, scroll behavior is unchanged unless users explicitly set these fields.

if you’d like, I can make the “mac” default explicit to darwin only to make it even more explicit

fyi, i used opencode to help create this PR

it makes scrolling much more native feeling for me on macbook pro (running in zed terminal window)

paulbettner avatar Nov 04 '25 07:11 paulbettner