mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
fix(tui): stop tab marquee after one cycle (#43936)
Co-authored-by: jlongster <17031+jlongster@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
e81450809d
commit
b2551b4e5d
@@ -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()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user