Skip to content

Commit a43a403

Browse files
committed
Simpliy multiline selections
1 parent 4b7a29a commit a43a403

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@ function listStyle(textarea: HTMLTextAreaElement, style: StyleArgs): SelectionRa
703703
selectionStart = Math.max(selectionStart + prefix(0).length + newlinesToAppend.length, 0)
704704
selectionEnd = selectionStart
705705
} else {
706-
selectionStart = Math.max(selectionStart + prefix(0).length + newlinesToAppend.length, 0)
707-
selectionEnd = selectionEnd + newlinesToAppend.length + totalPrefixLength
706+
selectionStart = Math.max(textarea.selectionStart + newlinesToAppend.length, 0)
707+
selectionEnd = textarea.selectionEnd + newlinesToAppend.length + totalPrefixLength
708708
}
709709

710710
const text = newlinesToAppend + lines.join('\n') + newlinesToPrepend

0 commit comments

Comments
 (0)