Add scroll acceleration support to TUI#4289
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds configurable scroll acceleration to the TUI with macOS-style smooth scrolling. The implementation allows users to enable smooth scrolling via scroll_acceleration.enabled or continue using custom linear speed with scroll_speed, with acceleration taking precedence when both are configured.
- Adds new configuration schema for scroll acceleration with an
enabledboolean flag - Implements
CustomSpeedScrollclass for linear scrolling and integratesMacOSScrollAccelfor smooth acceleration - Updates the session scrollbox component to use the configured scroll behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/sdk/js/src/gen/types.gen.ts | Adds TypeScript type definition for scroll_acceleration configuration option with enabled boolean field |
| packages/opencode/src/config/config.ts | Adds Zod schema validation for the new scroll_acceleration configuration option |
| packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | Implements scroll acceleration logic with CustomSpeedScroll class and integrates both acceleration modes into the session's scrollbox |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -438,6 +438,12 @@ export namespace Config { | |||
|
|
|||
| export const TUI = z.object({ | |||
| scroll_speed: z.number().min(1).optional().default(2).describe("TUI scroll speed"), | |||
There was a problem hiding this comment.
Now that this is considered, I would default it to 1, because the default linear scroll speed in opentui is what some users expect now.
kommander
left a comment
There was a problem hiding this comment.
If the MacOSScrollAccelaration had a multiplier option as well it could be configured for terminals where it is too fast. But that can be added with this setup.
Adds configurable scroll acceleration to the TUI with macOS-style smooth scrolling via
scroll_acceleration.enabledconfig option. Falls back to existingscroll_speedfor custom linear speed. Acceleration takes precedence when both are set.Now opencode will scroll faster than before because scroll speed is 2 by deafult. Should I change the default to 1?
Fix #3907