Skip to content

Commit

Permalink
Use zero-width space in context-menu select-all hack
Browse files Browse the repository at this point in the history
To prevent the mouse click from landing outside of the selected
text, which broke copy in IE.

Closes #1764
  • Loading branch information
marijnh committed Aug 22, 2013
1 parent ea27498 commit 4e0d423
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2169,8 +2169,8 @@ window.CodeMirror = (function() {

function prepareSelectAllHack() {
if (display.input.selectionStart != null) {
var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value);
display.prevInput = " ";
var extval = display.input.value = "\u200b" + (posEq(sel.from, sel.to) ? "" : display.input.value);
display.prevInput = "\u200b";
display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
}
}
Expand Down

0 comments on commit 4e0d423

Please sign in to comment.