File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ const codeRef = useTemplateRef('codeRef')
1313
1414// Using this so we can track the height of each line, and therefore compute digit sidebar
1515const lineMultipliers = ref <number []>([])
16+ const LINE_HEIGHT_PX = 24 // also used in css
1617
1718function updateLineMultipliers() {
1819 if (! codeRef .value ) return
1920 const lines = Array .from (codeRef .value .querySelectorAll (' code > .line' ))
20- lineMultipliers .value = lines
21- . map ( line => Math .round (parseFloat (getComputedStyle (line ).height ) / 24 )) // since each line "row" is 24px high
22- . filter ( m => m > 0 )
21+ lineMultipliers .value = lines . map ( line =>
22+ Math . max ( 1 , Math .round (parseFloat (getComputedStyle (line ).height ) / LINE_HEIGHT_PX )),
23+ )
2324}
2425
2526watch (
@@ -179,8 +180,8 @@ watch(
179180 display : flex ;
180181 flex-wrap : wrap ;
181182 /* Ensure consistent height matching line numbers */
182- line-height : 24 px ;
183- min-height : 24 px ;
183+ line-height : calc (v-bind(LINE_HEIGHT_PX) * 1 px ) ;
184+ min-height : calc (v-bind(LINE_HEIGHT_PX) * 1 px ) ;
184185 white-space : pre-wrap ;
185186 overflow : hidden ;
186187 transition : background-color 0.1s ;
You can’t perform that action at this time.
0 commit comments