{lines.map((codeLine, index) => {
const lineNumber = firstLineNumber + index
@@ -99,18 +112,23 @@ export default function MonacoCodeExcerpt({
return (
-
- {lineNumber}
-
+ {showLineNumbers ? (
+
+ {lineNumber}
+
+ ) : null}
{html ? (
) : (
-
+
{codeLine || ' '}
)}
diff --git a/src/renderer/src/components/editor/ipynb-code-cell-lines.test.ts b/src/renderer/src/components/editor/ipynb-code-cell-lines.test.ts
index 992794d236c..2e29fd53c4c 100644
--- a/src/renderer/src/components/editor/ipynb-code-cell-lines.test.ts
+++ b/src/renderer/src/components/editor/ipynb-code-cell-lines.test.ts
@@ -13,8 +13,9 @@ afterEach(() => {
describe('notebook code cell line derivation', () => {
it('derives preview lines including CRLF content', () => {
expect(getIpynbCodeCellPreviewLines('')).toEqual([''])
- expect(getIpynbCodeCellPreviewLines('one\ntwo\n')).toEqual(['one', 'two'])
- expect(getIpynbCodeCellPreviewLines('one\r\ntwo\r\n')).toEqual(['one', 'two'])
+ expect(getIpynbCodeCellPreviewLines('one\ntwo')).toEqual(['one', 'two'])
+ expect(getIpynbCodeCellPreviewLines('one\ntwo\n')).toEqual(['one', 'two', ''])
+ expect(getIpynbCodeCellPreviewLines('one\r\ntwo\r\n')).toEqual(['one', 'two', ''])
})
it('caps newline-heavy cells without splitting or walking the full payload', () => {
diff --git a/src/renderer/src/components/editor/ipynb-code-cell-lines.ts b/src/renderer/src/components/editor/ipynb-code-cell-lines.ts
index 550ede43410..7ec1eea42ab 100644
--- a/src/renderer/src/components/editor/ipynb-code-cell-lines.ts
+++ b/src/renderer/src/components/editor/ipynb-code-cell-lines.ts
@@ -25,11 +25,9 @@ export function getIpynbCodeCellPreviewLines(source: string): string[] {
lineStart = index + 1
}
- if (lineStart < scanLength) {
- lines.push(sliceIpynbCodeCellPreviewLine(source, lineStart, scanLength))
- }
-
- return lines.length > 0 ? lines : ['']
+ // A trailing newline still opens an empty last line, as it does in the Monaco model.
+ lines.push(sliceIpynbCodeCellPreviewLine(source, lineStart, scanLength))
+ return lines
}
function sliceIpynbCodeCellPreviewLine(source: string, lineStart: number, lineEnd: number): string {
diff --git a/src/renderer/src/lib/editor-font-zoom.ts b/src/renderer/src/lib/editor-font-zoom.ts
index 3febc21269b..e3a8cd16985 100644
--- a/src/renderer/src/lib/editor-font-zoom.ts
+++ b/src/renderer/src/lib/editor-font-zoom.ts
@@ -1,3 +1,5 @@
+import { buildFontFamily } from '@/components/terminal-pane/layout-serialization'
+
const EDITOR_FONT_ZOOM_MIN = -6
const EDITOR_FONT_ZOOM_MAX = 18
const EDITOR_FONT_ZOOM_STEP = 1
@@ -43,3 +45,11 @@ export type EditorFontFamilySettings = {
export function resolveEditorFontFamily(settings?: EditorFontFamilySettings | null): string {
return settings?.editorFontFamily?.trim() || settings?.terminalFontFamily || 'monospace'
}
+
+/**
+ * Fallback-backed stack for code painted outside Monaco. Monaco appends its own fallbacks to a
+ * bare name; a plain element does not, so an unresolvable name like "SF Mono" drops to serif.
+ */
+export function resolveEditorFontStack(settings?: EditorFontFamilySettings | null): string {
+ return buildFontFamily(settings?.editorFontFamily?.trim() || settings?.terminalFontFamily || '')
+}