@@ -637,7 +637,7 @@ function undoUnorderedListStyle(text: string): UndoResult {
637
637
}
638
638
}
639
639
640
- const prefix = ( index : number , unorderedList : boolean ) : string => {
640
+ function makePrefix ( index : number , unorderedList : boolean ) : string {
641
641
if ( unorderedList ) {
642
642
return '- '
643
643
} else {
@@ -671,20 +671,20 @@ function listStyle(textarea: HTMLTextAreaElement, style: StyleArgs): SelectionRa
671
671
}
672
672
673
673
const lines = selectedText . split ( '\n' ) . map ( ( value , index ) => {
674
- return `${ prefix ( index , style . unorderedList ) } ${ value } `
674
+ return `${ makePrefix ( index , style . unorderedList ) } ${ value } `
675
675
} )
676
676
677
677
const totalPrefixLength = lines . reduce ( ( previousValue , currentValue , currentIndex ) => {
678
- return previousValue + prefix ( currentIndex , style . unorderedList ) . length
678
+ return previousValue + makePrefix ( currentIndex , style . unorderedList ) . length
679
679
} , 0 )
680
680
681
681
const totalPrefixLengthOpositeList = lines . reduce ( ( previousValue , currentValue , currentIndex ) => {
682
- return previousValue + prefix ( currentIndex , ! style . unorderedList ) . length
682
+ return previousValue + makePrefix ( currentIndex , ! style . unorderedList ) . length
683
683
} , 0 )
684
684
685
685
if ( undoResult . processed ) {
686
686
if ( noInitialSelection ) {
687
- selectionStart = Math . max ( selectionStart - prefix ( 0 , style . unorderedList ) . length , 0 )
687
+ selectionStart = Math . max ( selectionStart - makePrefix ( 0 , style . unorderedList ) . length , 0 )
688
688
selectionEnd = selectionStart
689
689
} else {
690
690
selectionStart = textarea . selectionStart
@@ -696,7 +696,7 @@ function listStyle(textarea: HTMLTextAreaElement, style: StyleArgs): SelectionRa
696
696
const { newlinesToAppend, newlinesToPrepend} = newlinesToSurroundSelectedText ( textarea )
697
697
698
698
if ( noInitialSelection ) {
699
- selectionStart = Math . max ( selectionStart + prefix ( 0 , style . unorderedList ) . length + newlinesToAppend . length , 0 )
699
+ selectionStart = Math . max ( selectionStart + makePrefix ( 0 , style . unorderedList ) . length + newlinesToAppend . length , 0 )
700
700
selectionEnd = selectionStart
701
701
} else {
702
702
if ( undoResultOpositeList . processed ) {
0 commit comments