|
|
@@ -17,7 +17,14 @@ import { useRoute, useRouteData } from "@tui/context/route"
|
|
|
import { useSync } from "@tui/context/sync"
|
|
|
import { SplitBorder } from "@tui/component/border"
|
|
|
import { useTheme } from "@tui/context/theme"
|
|
|
-import { BoxRenderable, ScrollBoxRenderable, TextAttributes, addDefaultParsers } from "@opentui/core"
|
|
|
+import {
|
|
|
+ BoxRenderable,
|
|
|
+ ScrollBoxRenderable,
|
|
|
+ TextAttributes,
|
|
|
+ addDefaultParsers,
|
|
|
+ MacOSScrollAccel,
|
|
|
+ type ScrollAcceleration,
|
|
|
+} from "@opentui/core"
|
|
|
import { Prompt, type PromptRef } from "@tui/component/prompt"
|
|
|
import type { AssistantMessage, Part, ToolPart, UserMessage, TextPart, ReasoningPart } from "@opencode-ai/sdk"
|
|
|
import { useLocal } from "@tui/context/local"
|
|
|
@@ -62,6 +69,16 @@ import { LSP } from "@/lsp/index.ts"
|
|
|
|
|
|
addDefaultParsers(parsers.parsers)
|
|
|
|
|
|
+class CustomSpeedScroll implements ScrollAcceleration {
|
|
|
+ constructor(private speed: number) {}
|
|
|
+
|
|
|
+ tick(_now?: number): number {
|
|
|
+ return this.speed
|
|
|
+ }
|
|
|
+
|
|
|
+ reset(): void {}
|
|
|
+}
|
|
|
+
|
|
|
const context = createContext<{
|
|
|
width: number
|
|
|
conceal: () => boolean
|
|
|
@@ -95,6 +112,17 @@ export function Session() {
|
|
|
const sidebarVisible = createMemo(() => sidebar() === "show" || (sidebar() === "auto" && wide()))
|
|
|
const contentWidth = createMemo(() => dimensions().width - (sidebarVisible() ? 42 : 0) - 4)
|
|
|
|
|
|
+ const scrollAcceleration = createMemo(() => {
|
|
|
+ const tui = sync.data.config.tui
|
|
|
+ if (tui?.scroll_acceleration?.enabled) {
|
|
|
+ return new MacOSScrollAccel()
|
|
|
+ }
|
|
|
+ if (tui?.scroll_speed) {
|
|
|
+ return new CustomSpeedScroll(tui.scroll_speed)
|
|
|
+ }
|
|
|
+ return undefined
|
|
|
+ })
|
|
|
+
|
|
|
createEffect(async () => {
|
|
|
await sync.session
|
|
|
.sync(route.sessionID)
|
|
|
@@ -684,6 +712,7 @@ export function Session() {
|
|
|
stickyScroll={true}
|
|
|
stickyStart="bottom"
|
|
|
flexGrow={1}
|
|
|
+ scrollAcceleration={scrollAcceleration()}
|
|
|
>
|
|
|
<For each={messages()}>
|
|
|
{(message, index) => (
|