Fix line-wise pasting on Chrome Windows

Closes #6337
This commit is contained in:
Marijn Haverbeke 2020-07-08 08:35:24 +02:00
parent e2d786c758
commit b5ce22f1e3
1 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ export function applyTextInput(cm, inserted, deleted, sel, origin) {
from = Pos(from.line, from.ch - deleted) from = Pos(from.line, from.ch - deleted)
else if (cm.state.overwrite && !paste) // Handle overwrite else if (cm.state.overwrite && !paste) // Handle overwrite
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length))
else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
from = to = Pos(from.line, 0) from = to = Pos(from.line, 0)
} }
let changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines, let changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
@ -132,4 +132,4 @@ export function hiddenTextarea() {
if (ios) te.style.border = "1px solid black" if (ios) te.style.border = "1px solid black"
disableBrowserMagic(te) disableBrowserMagic(te)
return div return div
} }