Skip to content

Commit 86b288c

Browse files
committed
Remove all CodeMirror content padding in code dialogs
1 parent d2b0237 commit 86b288c

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/lib/components/dialogs/CodePreviewDialog.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@
2727
const MAX_LINES = 35;
2828
const LINE_HEIGHT_PX = 18.2; // CodeMirror default with 14px font
2929
const HEADER_HEIGHT_PX = 41; // Dialog header
30-
const CM_PADDING_PX = 8; // .cm-content top padding only (bottom removed via CSS)
3130
3231
let lineCount = $derived(code.split('\n').length);
3332
let dialogHeight = $derived(() => {
3433
const lines = Math.min(lineCount, MAX_LINES);
35-
return Math.ceil(lines * LINE_HEIGHT_PX + CM_PADDING_PX + HEADER_HEIGHT_PX);
34+
return Math.ceil(lines * LINE_HEIGHT_PX + HEADER_HEIGHT_PX);
3635
});
3736
3837
// Subscribe to theme changes
@@ -210,7 +209,7 @@
210209
}
211210
212211
.code-preview :global(.cm-content) {
213-
padding: 8px 0 0 0;
212+
padding: 0;
214213
}
215214
216215
.loading {

src/lib/components/dialogs/ExportDialog.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
const MAX_LINES = 35;
4343
const LINE_HEIGHT_PX = 18.2; // CodeMirror default with 14px font
4444
const HEADER_HEIGHT_PX = 41; // Dialog header
45-
const CM_PADDING_PX = 8; // .cm-content top padding only (bottom removed via CSS)
4645
4746
let lineCount = $derived(pythonCode.split('\n').length);
4847
let dialogHeight = $derived(() => {
4948
const lines = Math.min(lineCount, MAX_LINES);
50-
return Math.ceil(lines * LINE_HEIGHT_PX + CM_PADDING_PX + HEADER_HEIGHT_PX);
49+
return Math.ceil(lines * LINE_HEIGHT_PX + HEADER_HEIGHT_PX);
5150
});
5251
5352
// Handle dialog open/close
@@ -230,7 +229,7 @@
230229
}
231230
232231
.code-preview :global(.cm-content) {
233-
padding: 8px 0 0 0;
232+
padding: 0;
234233
}
235234
236235
.loading {

0 commit comments

Comments
 (0)