GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): refine tab marquee motion by kitlangton · Pull Request #42617 · anomalyco/opencode

fix(tui): refine tab marquee motion #42617

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.

Sign up for GitHub

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

Merged
kitlangton merged 3 commits into v2 from dim-marquee-dot
Aug 14, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(tui): refine tab marquee motion #42617

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
80b1d7a
fix(tui): refine tab marquee motion
kitlangton Aug 14, 2026
4396cf2
fix(tui): speed up tab marquee
kitlangton Aug 14, 2026
2997c04
fix(tui): settle marquee cadence
kitlangton Aug 14, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(tui): speed up tab marquee
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton committed Aug 14, 2026
commit 4396cf2fc663bb1a66cceff99f6f5ff3d8abebe3

There are no files selected for viewing

47 changes: 27 additions & 20 deletions 47 packages/tui/src/component/session-tabs.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RGBA, ScrollBoxRenderable, TextAttributes, type MouseEvent } from "@opentui/core"
import {
For,
Index,
Match,
Show,
Switch,
Expand Down Expand Up @@ -34,7 +35,7 @@ import { TabPulse, unreadGlowIntensity } from "./tab-pulse"
import { tint } from "../theme/color"
import { SESSION_SIDEBAR_WIDTH } from "../ui/layout"
import { projectName } from "../util/project"
import { marqueeCycleWidth, marqueeOverflows, marqueeText, marqueeTextParts } from "../util/marquee"
import { marqueeCycleWidth, marqueeOverflows, marqueeTextParts } from "../util/marquee"
import { useDialog } from "../ui/dialog"
import { DialogSessionRename } from "./dialog-session-rename"

Expand All @@ -43,7 +44,7 @@ const FADE_WIDTH = 4
// The add button renders as " + " at the end of the strip, so the tab layout leaves it room.
const ADD_TAB_WIDTH = 3
const MARQUEE_DELAY = 600
const MARQUEE_INTERVAL = 80
const MARQUEE_INTERVAL = 70
const CONTEXT_MENU_WIDTH = 16
const RIGHT_MOUSE_BUTTON = 2

Expand Down Expand Up @@ -393,15 +394,18 @@ function VerticalSessionTabs(props: { controller?: SessionTabsController; animat
const titleWidth = () => (hovered() === tab.sessionID ? hoveredTitleWidth() : restingTitleWidth())
const title = () => tab.title ?? "Untitled session"
const scrolling = () => marquee.active() === tab.sessionID
const visibleTitle = createMemo(() =>
scrolling()
? marqueeText(title(), titleWidth(), marquee.offset())
: Locale.takeWidth(title(), titleWidth()),
)
const visibleTitleParts = createMemo(() =>
scrolling()
? marqueeTextParts(title(), titleWidth(), marquee.offset())
: Locale.graphemes(visibleTitle()).map((value) => ({ value, separator: false })),
: Locale.graphemes(Locale.takeWidth(title(), titleWidth())).map((value) => ({
value,
separator: false,
})),
)
const visibleTitle = createMemo(() =>
visibleTitleParts()
.map((part) => part.value)
.join(""),
)
const titleFades = createMemo(() => marqueeOverflows(title(), titleWidth()) && titleWidth() > FADE_WIDTH)
const detail = createMemo(() => {
Expand Down Expand Up @@ -656,11 +660,11 @@ function VerticalSessionTabs(props: { controller?: SessionTabsController; animat
when={scrolling() || titleGlow.value().level > 0 || titleFades()}
fallback={visibleTitle()}
>
<For each={visibleTitleParts()}>
<Index each={visibleTitleParts()}>
{(part, index) => (
<span style={{ fg: titleColor(index(), part.separator) }}>{part.value}</span>
<span style={{ fg: titleColor(index, part().separator) }}>{part().value}</span>
)}
</For>
</Index>
</Show>
</text>
<text
Expand Down Expand Up @@ -993,15 +997,18 @@ function HorizontalSessionTabs(props: { controller?: SessionTabsController; anim
const hoveredTitleWidth = () => Math.max(1, restingTitleWidth() - 2)
const availableTitleWidth = () => (hovered() === tab.sessionID ? hoveredTitleWidth() : restingTitleWidth())
const scrolling = () => marquee.active() === tab.sessionID
const visibleTitle = createMemo(() =>
scrolling()
? marqueeText(title(), availableTitleWidth(), marquee.offset())
: Locale.takeWidth(title(), availableTitleWidth()),
)
const visibleTitleParts = createMemo(() =>
scrolling()
? marqueeTextParts(title(), availableTitleWidth(), marquee.offset())
: Locale.graphemes(visibleTitle()).map((value) => ({ value, separator: false })),
: Locale.graphemes(Locale.takeWidth(title(), availableTitleWidth())).map((value) => ({
value,
separator: false,
})),
)
const visibleTitle = createMemo(() =>
visibleTitleParts()
.map((part) => part.value)
.join(""),
)
const titleFades = createMemo(
() => marqueeOverflows(title(), availableTitleWidth()) && availableTitleWidth() > FADE_WIDTH,
Expand Down Expand Up @@ -1116,11 +1123,11 @@ function HorizontalSessionTabs(props: { controller?: SessionTabsController; anim
attributes={bold()}
>
<Show when={scrolling() || glows() || titleFades()} fallback={visibleTitle()}>
<For each={visibleTitleParts()}>
<Index each={visibleTitleParts()}>
{(part, index) => (
<span style={{ fg: characterColor(index(), part.separator) }}>{part.value}</span>
<span style={{ fg: characterColor(index, part().separator) }}>{part().value}</span>
)}
</For>
</Index>
</Show>
</text>
<text
Expand Down
18 changes: 9 additions & 9 deletions 18 packages/tui/src/util/marquee.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ export function marqueeTextParts(value: string, width: number, offset: number):
state.width >= cursor ? state : { index: index + 1, width: state.width + stringWidth(part.value) },
{ index: 0, width: 0 },
).index
const visible = Locale.graphemes(
Locale.takeWidth(
parts
.slice(start)
.map((part) => part.value)
.join(""),
width,
),
).length
const visible = parts.slice(start).reduce(
(state, part) => {
if (state.done) return state
const next = stringWidth(part.value)
if (state.width + next > width) return { ...state, done: true }
return { count: state.count + 1, width: state.width + next, done: false }
},
{ count: 0, width: 0, done: false },
).count
return parts.slice(start, start + visible)
}
2 changes: 1 addition & 1 deletion 2 packages/tui/test/component/session-tabs-marquee.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("session tab marquee", () => {
const scope = createRoot((dispose) => ({ marquee: createMarquee(() => false), dispose }))

scope.marquee.enter("first", "opencode", 6)
jest.advanceTimersByTime(1_400)
jest.advanceTimersByTime(1_300)

expect(scope.marquee.active()).toBe("first")
expect(scope.marquee.offset()).toBe(0)
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.