Skip to content

Commit b25f857

Browse files
committed
Normalize line endings in inserted/pasted content
Issue #4289
1 parent edd8e61 commit b25f857

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/input/input.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ios, webkit } from "../util/browser"
77
import { elt } from "../util/dom"
88
import { lst, map } from "../util/misc"
99
import { signalLater } from "../util/operation_group"
10+
import { splitLinesAuto } from "../util/feature_detection"
1011

1112
import { indentLine } from "./indent"
1213

@@ -25,7 +26,7 @@ export function applyTextInput(cm, inserted, deleted, sel, origin) {
2526
if (!sel) sel = doc.sel
2627

2728
let paste = cm.state.pasteIncoming || origin == "paste"
28-
let textLines = doc.splitLines(inserted), multiPaste = null
29+
let textLines = splitLinesAuto(inserted), multiPaste = null
2930
// When pasing N lines into N selections, insert one line per selection
3031
if (paste && sel.ranges.length > 1) {
3132
if (lastCopied && lastCopied.text.join("\n") == inserted) {

0 commit comments

Comments
 (0)