File tree Expand file tree Collapse file tree
src/lib/components/dialogs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525
2626 // Line count for dynamic height
2727 const MAX_LINES = 35 ;
28- const LINE_HEIGHT_PX = 20 ;
29- const HEADER_HEIGHT_PX = 48 ;
30- const PADDING_PX = 16 ;
28+ const LINE_HEIGHT_PX = 18.2 ; // CodeMirror default with 14px font
29+ const HEADER_HEIGHT_PX = 41 ; // Dialog header
30+ const CM_PADDING_PX = 16 ; // .cm-content padding (8px top + 8px bottom)
3131
3232 let lineCount = $derived (code .split (' \n ' ).length );
3333 let dialogHeight = $derived (() => {
3434 const lines = Math .min (lineCount , MAX_LINES );
35- const contentHeight = lines * LINE_HEIGHT_PX + PADDING_PX ;
36- return contentHeight + HEADER_HEIGHT_PX ;
35+ return Math .ceil (lines * LINE_HEIGHT_PX + CM_PADDING_PX + HEADER_HEIGHT_PX );
3736 });
3837
3938 // Subscribe to theme changes
Original file line number Diff line number Diff line change 4040
4141 // Line count for dynamic height
4242 const MAX_LINES = 35 ;
43- const LINE_HEIGHT_PX = 20 ; // Approximate line height in CodeMirror
44- const HEADER_HEIGHT_PX = 48 ; // Dialog header height
45- const PADDING_PX = 16 ; // Vertical padding
43+ const LINE_HEIGHT_PX = 18.2 ; // CodeMirror default with 14px font
44+ const HEADER_HEIGHT_PX = 41 ; // Dialog header
45+ const CM_PADDING_PX = 16 ; // .cm-content padding (8px top + 8px bottom)
4646
4747 let lineCount = $derived (pythonCode .split (' \n ' ).length );
4848 let dialogHeight = $derived (() => {
4949 const lines = Math .min (lineCount , MAX_LINES );
50- const contentHeight = lines * LINE_HEIGHT_PX + PADDING_PX ;
51- return contentHeight + HEADER_HEIGHT_PX ;
50+ return Math .ceil (lines * LINE_HEIGHT_PX + CM_PADDING_PX + HEADER_HEIGHT_PX );
5251 });
5352
5453 // Handle dialog open/close
You can’t perform that action at this time.
0 commit comments