fix(tui): stop tab marquee after one cycle (#43936)

Co-authored-by: jlongster <17031+jlongster@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-08-21 14:10:54 -04:00
committed by GitHub
Unverified
parent e81450809d
commit b2551b4e5d
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -116,7 +116,16 @@ export function createMarquee(animations: () => boolean) {
interval = undefined
}
const scroll = () => {
interval = setInterval(() => setOffset((value) => (value + 1) % cycleWidth), MARQUEE_INTERVAL)
interval = setInterval(
() =>
setOffset((value) => {
if (value + 1 < cycleWidth) return value + 1
clear()
leading.animate({ opacity: 0 })
return 0
}),
MARQUEE_INTERVAL,
)
}
const enter = (sessionID: string, title: string, width: number) => {
if (!marqueeOverflows(title, width)) {
@@ -23,7 +23,7 @@ describe("session tab marquee", () => {
scope.dispose()
})
test("keeps the leading fade through a natural loop boundary", () => {
test("stops after one cycle", () => {
jest.useFakeTimers()
const scope = createRoot((dispose) => ({ marquee: createMarquee(() => false), dispose }))
@@ -32,7 +32,7 @@ describe("session tab marquee", () => {
expect(scope.marquee.active()).toBe("first")
expect(scope.marquee.offset()).toBe(0)
expect(scope.marquee.leading()).toBe(1)
expect(scope.marquee.leading()).toBe(0)
scope.dispose()
})