Skip to content

Commit

Permalink
Remove fakedLastChar hack
Browse files Browse the repository at this point in the history
Issue #1474 was the cause of this hack
Issue #2384 was apparently caused by it

Recent Webkit-ish browsers seem to no longer have the problem that
it was working around.
  • Loading branch information
marijnh committed Mar 18, 2014
1 parent eda588e commit 475b2be
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2202,11 +2202,6 @@
// will be the case when there is a lot of text in the textarea,
// in which case reading its value would be expensive.
if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.options.disableInput) return false;
// See paste handler for more on the fakedLastChar kludge
if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
input.value = input.value.substring(0, input.value.length - 1);
cm.state.fakedLastChar = false;
}
var text = input.value;
// If nothing changed, bail.
if (text == prevInput && !cm.somethingSelected()) return false;
Expand Down Expand Up @@ -2401,16 +2396,6 @@
fastPoll(cm);
});
on(d.input, "paste", function() {
// Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206
// Add a char to the end of textarea before paste occur so that
// selection doesn't span to the end of textarea.
if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {
var start = d.input.selectionStart, end = d.input.selectionEnd;
d.input.value += "$";
d.input.selectionStart = start;
d.input.selectionEnd = end;
cm.state.fakedLastChar = true;
}
cm.state.pasteIncoming = true;
fastPoll(cm);
});
Expand Down

0 comments on commit 475b2be

Please sign in to comment.