Repository navigation
feat(settings): delete imported terminal themes from the theme picker - #37356
Conversation
|
No actionable comments were generated in the recent review.
|
17ca819 to
e000951
Compare
…hoices, focus stays in picker
e000951 to
a277bb8
Compare
Summary
Themes imported from Warp or YAML are stored in
terminalCustomThemes, and until now nothing in the UI could remove one. Re-importing an edited file also creates a new entry, because the id includes a content hash, so the picker filled up with stale copies.What changes: hovering or focusing an Imported row in Settings → Appearance → Terminal Themes now shows a ghost trash button with a tooltip. Built-in and plugin rows don't get one. Deleting a theme shows a toast with Undo, following the same pattern as removing a browser history suggestion.
No dangling selections. The core change is one shared function,
terminalCustomThemeRemovalinsrc/shared/terminal-theme-selection.ts:terminalThemeDarkorterminalThemeLight, the per-mode slots from fix(terminal): scope terminal color overrides to their light/dark theme slot #36581) goes back to that slot's default.custom:selection. Match Terminal, native chat, previews, OSC replies and mobile all derive their colors from these slots throughresolveTerminalPalette, so they follow the fallback automatically.Undo puts the theme back only if it hasn't been re-imported since. It restores a slot only if the user hasn't changed that slot since (it still shows the default and has no overrides). An Undo can't overwrite a newer choice.
Writes are serialized. The store applies a settings write only once it's acknowledged, so two quick deletes would each be computed from the same stale list and the first deleted theme would come back. Deletes and undos therefore go through a small promise queue that reads the latest store settings before each write. The bug was reproduced by Codex against the real
persistVisibilityAwareSettings, then verified fixed in the app.Not done: upserting on re-import of the same file name (the issue's alternative ask). The id includes a content hash on purpose, and delete covers the clutter case.
Closes #32138
Visual proof
Before (
origin/main), with no way to remove an imported theme:After, dark mode, hovering the selected imported theme:
After deleting the selected Dusk: the dark slot falls back to Ghostty Default Style Dark (shown in the "Selected" line and the live preview), focus moves to the search field, and the toast offers Undo:
After, light mode:
Merge-risk assessment: Low
updateSettingspatch of existing keys (terminalCustomThemes,terminalThemeDark/Light,terminalColorOverrides(Light)). It goes through the same store path on desktop, the web client and remoteorca servesettings.custom:selection already fall back to the slot default on read (resolveTerminalPalette), so nothing breaks either way. Clearing overrides uses the sameundefinedpatch the picker already sends.Negative user-facing tradeoffs
Validation
pnpm test src/shared/terminal-theme-selection.test.tspasses (12 tests). The new cases cover fallback of both slots and Undo, Undo keeping a later slot change, Undo not clobbering a re-import, and slots showing another theme being left untouched.pnpm testonTerminalThemeSections.lifecycle.test.ts,TerminalPane.section-lifetime.test.tsxandAppearancePane.test.tsxpasses (46 tests).pnpm tc:webpasses.pnpm tc:nodereports one error inagent-model-catalog-scaling.test.ts(a missing module, unrelated to this branch); the files this PR touches typecheck clean. oxlint is clean.pnpm sync:localization-catalogplus theverify:localization-*protected-copy and extraction checks pass.ORCA_BACKGROUND_LAUNCH=1dev build, CDP port 9361, throwawayHOMEand user-data dir. I seeded three imported themes, with Dusk selected for dark (plus a cursor override) and Dawn selected for light. Through the real picker I checked:fetchSettings).gpt-6.1-sol, xhigh) was cut off at about 5.5 minutes before it wrote its final summary. Before that, it reproduced three findings, all fixed here: the stale double delete, Undo clobbering overrides edited later, and Undo clobbering a re-import. Opus findings also fixed: focus loss after delete, the button being undiscoverable on touch (hover:nonenow keeps it visible), and the inner button's focus ring radius.Perf
origin/main(perf-scan questions 1–6).MAX_THEME_RESULTS), and only on the Settings page. Tooltip content mounts only on hover.