This repository was archived by the owner on Apr 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -592,11 +592,13 @@ class EditContextManager {
592592 for ( let format of e . getTextFormats ( ) ) {
593593 let lineStyle = format . underlineStyle , thickness = format . underlineThickness
594594 if ( lineStyle != "None" && thickness != "None" ) {
595- let style = `text-decoration: underline ${
596- lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""
597- } ${ thickness == "Thin" ? 1 : 2 } px`
598- deco . push ( Decoration . mark ( { attributes : { style} } )
599- . range ( this . toEditorPos ( format . rangeStart ) , this . toEditorPos ( format . rangeEnd ) ) )
595+ let from = this . toEditorPos ( format . rangeStart ) , to = this . toEditorPos ( format . rangeEnd )
596+ if ( from < to ) {
597+ let style = `text-decoration: underline ${
598+ lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""
599+ } ${ thickness == "Thin" ? 1 : 2 } px`
600+ deco . push ( Decoration . mark ( { attributes : { style} } ) . range ( from , to ) )
601+ }
600602 }
601603 }
602604 view . dispatch ( { effects : setEditContextFormatting . of ( Decoration . set ( deco ) ) } )
@@ -713,6 +715,7 @@ class EditContextManager {
713715 }
714716
715717 toEditorPos ( contextPos : number ) {
718+ contextPos = Math . min ( contextPos , this . to - this . from )
716719 let c = this . composing
717720 return c && c . drifted ? c . editorBase + ( contextPos - c . contextBase ) : contextPos + this . from
718721 }
You can’t perform that action at this time.
0 commit comments