diff --git a/frontend/app/view/codeeditor/codeeditor.tsx b/frontend/app/view/codeeditor/codeeditor.tsx index 3f278a6825..971fb4db4f 100644 --- a/frontend/app/view/codeeditor/codeeditor.tsx +++ b/frontend/app/view/codeeditor/codeeditor.tsx @@ -108,11 +108,12 @@ interface CodeEditorProps { text: string; readonly: boolean; language?: string; + fileName?: string; onChange?: (text: string) => void; onMount?: (monacoPtr: MonacoTypes.editor.IStandaloneCodeEditor, monaco: Monaco) => () => void; } -export function CodeEditor({ blockId, text, language, readonly, onChange, onMount }: CodeEditorProps) { +export function CodeEditor({ blockId, text, language, fileName, readonly, onChange, onMount }: CodeEditorProps) { const divRef = useRef(null); const unmountRef = useRef<() => void>(null); const minimapEnabled = useOverrideConfigAtom(blockId, "editor:minimapenabled") ?? false; @@ -120,7 +121,7 @@ export function CodeEditor({ blockId, text, language, readonly, onChange, onMoun const wordWrap = useOverrideConfigAtom(blockId, "editor:wordwrap") ?? false; const fontSize = boundNumber(useOverrideConfigAtom(blockId, "editor:fontsize"), 6, 64); const theme = "wave-theme-dark"; - const editorPath = useRef(crypto.randomUUID()).current; + const editorPath = useRef(fileName ?? crypto.randomUUID()).current; React.useEffect(() => { return () => { diff --git a/frontend/app/view/preview/preview-edit.tsx b/frontend/app/view/preview/preview-edit.tsx index f249f7ee7f..10a55d604c 100644 --- a/frontend/app/view/preview/preview-edit.tsx +++ b/frontend/app/view/preview/preview-edit.tsx @@ -16,6 +16,7 @@ function CodeEditPreview({ model }: SpecializedViewProps) { const fileContent = useAtomValue(model.fileContent); const setNewFileContent = useSetAtom(model.newFileContent); const fileInfo = useAtomValue(model.statFile); + const fileName = fileInfo?.path || fileInfo?.name; function codeEditKeyDownHandler(e: WaveKeyboardEvent): boolean { if (checkKeyPressed(e, "Cmd:e")) { @@ -65,6 +66,7 @@ function CodeEditPreview({ model }: SpecializedViewProps) { setNewFileContent(text)} onMount={onMount} diff --git a/frontend/app/view/term/termutil.ts b/frontend/app/view/term/termutil.ts index 4874d7903b..785bc8876b 100644 --- a/frontend/app/view/term/termutil.ts +++ b/frontend/app/view/term/termutil.ts @@ -29,7 +29,8 @@ function computeTheme( } } let bgcolor = themeCopy.background; - themeCopy.background = "#00000000"; + // Keep the actual background color in the theme so terminal applications + // like Neovim can properly detect the background color for syntax highlighting return [themeCopy, bgcolor]; }