Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: editor theme on reopen and terminal edge

ogsamratac43af604edb
diff --git a/apps/app/src/app/index.css b/apps/app/src/app/index.css
index 1ef4dd35..514d5b2f 100644
--- a/apps/app/src/app/index.css
+++ b/apps/app/src/app/index.css
@@ -277,6 +277,11 @@ html[data-omnirush-palette] :is(.markdown-content [data-omnirush-code-block] .sh
color: var(--destructive) !important;
}
+/* xterm 6 paints its viewport black under the rows; with a theme it takes the terminal background. */
+html[data-omnirush-palette] .xterm .xterm-viewport {
+ background-color: var(--omnirush-terminal-bg) !important;
+}
+
/* KaTeX sets its own absolute font-size; keep formulas at the surrounding text size
so inline math does not tower over the sentence it sits in. */
.markdown-content .katex {
diff --git a/apps/app/src/react-app/domains/session/editor/editor-surface.tsx b/apps/app/src/react-app/domains/session/editor/editor-surface.tsx
index 8928d203..c0ce6aba 100644
--- a/apps/app/src/react-app/domains/session/editor/editor-surface.tsx
+++ b/apps/app/src/react-app/domains/session/editor/editor-surface.tsx
@@ -116,10 +116,11 @@ export function EditorSurface({ monaco, surface, onSave, onCursor, onHunks, navi
// The editors, once.
useEffect(() => {
if (!codeHostRef.current || !diffHostRef.current) return;
- const code = monaco.editor.create(codeHostRef.current, { ...BASE_OPTIONS, model: null, theme: monacoThemeName() });
+ const themeName = monacoThemeName();
+ const code = monaco.editor.create(codeHostRef.current, { ...BASE_OPTIONS, model: null, theme: themeName });
const diff = monaco.editor.createDiffEditor(diffHostRef.current, {
...BASE_OPTIONS,
- theme: monacoThemeName(),
+ theme: themeName,
renderSideBySide: false,
useInlineViewWhenSpaceIsLimited: true,
renderMarginRevertIcon: false,
diff --git a/apps/app/src/react-app/domains/session/editor/monaco.ts b/apps/app/src/react-app/domains/session/editor/monaco.ts
index 10a9253f..877b8597 100644
--- a/apps/app/src/react-app/domains/session/editor/monaco.ts
+++ b/apps/app/src/react-app/domains/session/editor/monaco.ts
@@ -160,14 +160,12 @@ function defineThemes(): string {
themeGeneration += 1;
const name = `omnirush-${data.base === "vs-dark" ? "dark" : "light"}-${themeGeneration}`;
monaco.editor.defineTheme(name, data);
- currentThemeName = name;
return name;
}
-let currentThemeName = "";
-
+/** Defines the editor theme from the current app theme (an editor created later must not reuse a stale one). */
export function monacoThemeName(): string {
- return currentThemeName || defineThemes();
+ return defineThemes();
}
/** Re-reads the active theme and switches the editor theme (mode, preset or custom theme changed). */
diff --git a/apps/app/src/react-app/domains/settings/appearance/custom-theme-editor.tsx b/apps/app/src/react-app/domains/settings/appearance/custom-theme-editor.tsx
index a79eb04e..c160b8aa 100644
--- a/apps/app/src/react-app/domains/settings/appearance/custom-theme-editor.tsx
+++ b/apps/app/src/react-app/domains/settings/appearance/custom-theme-editor.tsx
@@ -208,6 +208,8 @@ export type CustomThemeEditorProps = {
startedFrom: string;
/** Whether Apply should be enabled without edits (new or imported theme). */
unsavedFromStart: boolean;
+ /** Applying replaces an existing custom theme (one slot). */
+ replaces?: boolean;
preferredMode: ThemeVariantMode;
onPreview: (theme: CustomTheme) => void;
onApply: (theme: CustomTheme) => void;
@@ -428,6 +430,7 @@ export function CustomThemeEditor(props: CustomThemeEditorProps) {
{changed > 0 ? ` · ${changed} colour${changed === 1 ? "" : "s"} changed in the ${mode} version` : ""}
{changedOther > 0 ? ` · ${changedOther} in the ${otherMode} version` : ""}
{allWarnings > 0 ? ` · ${allWarnings} contrast warning${allWarnings === 1 ? "" : "s"}` : ""}
+ {props.replaces ? " · Apply replaces your current custom theme" : ""}
</span>
<Button variant="outline" size="sm" onClick={props.onRevert} data-testid="theme-revert">
Revert
diff --git a/apps/app/src/react-app/domains/settings/appearance/theme-presets-section.tsx b/apps/app/src/react-app/domains/settings/appearance/theme-presets-section.tsx
index 644b207e..19563768 100644
--- a/apps/app/src/react-app/domains/settings/appearance/theme-presets-section.tsx
+++ b/apps/app/src/react-app/domains/settings/appearance/theme-presets-section.tsx
@@ -139,7 +139,7 @@ export function ThemePresetsSection(props: Props) {
<span className="flex h-16 w-full items-center justify-center rounded-lg border border-dashed border-border">
<Plus className="size-4" />
</span>
- <span className="px-1 pb-0.5 font-medium">{props.customTheme ? "Edit custom theme" : "New custom theme"}</span>
+ <span className="px-1 pb-0.5 font-medium">{props.customTheme && props.selectedId === "custom" ? "Edit custom theme" : "New custom theme"}</span>
</button>
</div>
<p className="flex items-center gap-1.5 text-xs text-muted-foreground" data-testid="theme-mode-note" role="status">
diff --git a/apps/app/src/react-app/domains/settings/pages/appearance-view.tsx b/apps/app/src/react-app/domains/settings/pages/appearance-view.tsx
index 17a05cad..82e68d33 100644
--- a/apps/app/src/react-app/domains/settings/pages/appearance-view.tsx
+++ b/apps/app/src/react-app/domains/settings/pages/appearance-view.tsx
@@ -139,6 +139,7 @@ export function AppearanceView(props: AppearanceViewProps) {
initial={editor.initial}
startedFrom={editor.startedFrom}
unsavedFromStart={editor.unsavedFromStart}
+ replaces={Boolean(customTheme) && editor.unsavedFromStart}
preferredMode={active.mode}
onPreview={(theme) => setThemePreview(theme)}
onApply={keepTheme}