-
Notifications
You must be signed in to change notification settings - Fork 15.7k
fix(tui): apply scroll configuration uniformly across all scrollboxes #14735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f9ef278
cd5ead9
7d48823
c4d2178
08a4e3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,9 @@ import { useDialog, type DialogContext } from "@tui/ui/dialog" | |
| import { useKeybind } from "@tui/context/keybind" | ||
| import { Keybind } from "@/util/keybind" | ||
| import { Locale } from "@/util/locale" | ||
| import { useSync } from "@tui/context/sync" | ||
| import { getScrollAcceleration } from "../util/scroll" | ||
| import { useTuiConfig } from "../context/tui-config" | ||
|
|
||
| export interface DialogSelectProps<T> { | ||
| title: string | ||
|
|
@@ -50,6 +53,10 @@ export type DialogSelectRef<T> = { | |
| export function DialogSelect<T>(props: DialogSelectProps<T>) { | ||
| const dialog = useDialog() | ||
| const { theme } = useTheme() | ||
| const sync = useSync() | ||
| const tuiConfig = useTuiConfig() | ||
| const scrollAcceleration = createMemo(() => getScrollAcceleration(tuiConfig)) | ||
|
Comment on lines
54
to
+58
|
||
|
|
||
| const [store, setStore] = createStore({ | ||
| selected: 0, | ||
| filter: "", | ||
|
|
@@ -276,6 +283,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) { | |
| paddingLeft={1} | ||
| paddingRight={1} | ||
| scrollbarOptions={{ visible: false }} | ||
| scrollAcceleration={scrollAcceleration()} | ||
| ref={(r: ScrollBoxRenderable) => (scroll = r)} | ||
| maxHeight={height()} | ||
| > | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||
| import { MacOSScrollAccel, type ScrollAcceleration } from "@opentui/core" | ||||||
| import { TuiConfig } from "@/config/tui" | ||||||
|
||||||
| import { TuiConfig } from "@/config/tui" | |
| import type { TuiConfig } from "@/config/tui" |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (tuiConfig?.scroll_speed) relies on truthiness. It’s safer to check explicitly for a number/defined value (e.g. !== undefined) so valid values like 0 (or future schema changes) don’t accidentally fall back to the default speed.
| if (tuiConfig?.scroll_speed) { | |
| if (tuiConfig?.scroll_speed !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s now an
importafter theaddDefaultParsers(...)statement. Consider movinggetScrollAccelerationup with the other imports for consistency, and remove the now-unusedMacOSScrollAccel/ScrollAccelerationimports from@opentui/coresince the logic moved toutil/scroll.