fix(tui): fade full-width tab titles (#39409)
This commit is contained in:
parent
43383d4fba
commit
38a3dbb4c4
1 changed files with 4 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import { useTheme, useThemes } from "../context/theme"
|
||||||
import { adaptiveSessionTabLayout, sessionTabComplete, SESSION_TAB_OVERFLOW_WIDTH } from "../context/session-tabs-model"
|
import { adaptiveSessionTabLayout, sessionTabComplete, SESSION_TAB_OVERFLOW_WIDTH } from "../context/session-tabs-model"
|
||||||
import { createAnimatable, spring } from "../ui/animation"
|
import { createAnimatable, spring } from "../ui/animation"
|
||||||
import { Locale } from "../util/locale"
|
import { Locale } from "../util/locale"
|
||||||
|
import { stringWidth } from "../util/string-width"
|
||||||
import { TabPulse } from "./tab-pulse"
|
import { TabPulse } from "./tab-pulse"
|
||||||
import { tint } from "../theme/color"
|
import { tint } from "../theme/color"
|
||||||
|
|
||||||
|
|
@ -138,7 +139,9 @@ export function SessionTabs() {
|
||||||
const visibleTitleParts = createMemo(() => Locale.graphemes(visibleTitle()))
|
const visibleTitleParts = createMemo(() => Locale.graphemes(visibleTitle()))
|
||||||
const fadeWidth = () => (hovered() === tab.sessionID ? 6 : 4)
|
const fadeWidth = () => (hovered() === tab.sessionID ? 6 : 4)
|
||||||
const fadedTitleParts = createMemo(() => visibleTitleParts().slice(-fadeWidth()))
|
const fadedTitleParts = createMemo(() => visibleTitleParts().slice(-fadeWidth()))
|
||||||
const titleFades = createMemo(() => visibleTitle() !== title() && availableTitleWidth() > fadeWidth())
|
const titleFades = createMemo(
|
||||||
|
() => stringWidth(title()) >= availableTitleWidth() && availableTitleWidth() > fadeWidth(),
|
||||||
|
)
|
||||||
const foreground = () => {
|
const foreground = () => {
|
||||||
if (hovered() === tab.sessionID) return theme.text.default
|
if (hovered() === tab.sessionID) return theme.text.default
|
||||||
return tint(theme.text.subdued, theme.text.default, selection())
|
return tint(theme.text.subdued, theme.text.default, selection())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue