Skip to content

Commit bc2eca9

Browse files
committed
fix(tui): persist terminal theme subscription
1 parent 3019ae5 commit bc2eca9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎packages/tui/src/context/theme.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
144144
}
145145

146146
onMount(() => {
147+
// Desktop PTYs may start before their terminal frontend attaches. These bytes are
148+
// replayed on attach, avoiding the terminal capability probe's startup timeout.
149+
process.stdout.write("\x1b[?2031h\x1b[?996n")
147150
void Promise.allSettled([resolveSystemTheme(store.mode), syncCustomThemes()]).finally(() => {
148151
setStore("ready", true)
149152
})
@@ -246,6 +249,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
246249
unsubscribeRefresh = themes.subscribeRefresh?.(refresh)
247250

248251
onCleanup(() => {
252+
process.stdout.write("\x1b[?2031l")
249253
renderer.off(CliRenderEvents.THEME_MODE, handle)
250254
renderer.removeInputHandler(handleThemeNotification)
251255
unsubscribeRefresh?.()

0 commit comments

Comments
 (0)