Skip to content

Commit

Permalink
[paste] Fix #2384 and #1883
Browse files Browse the repository at this point in the history
As described in the comment, there was actually an intermediate selection being created, which clobbered the middle-click paste buffer and thus resulted in a $ being pasted instead of the actual content the user wanted. It's still a mystery why you couldn't repro it, but my guess is that due to some configuration (maybe in your window manager) your system wasn't updating the paste buffer as eagerly as Debian and Unity do by default.
  • Loading branch information
mtaran-google authored and marijnh committed Jun 23, 2014
1 parent e5e2e16 commit 357e941
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2452,8 +2452,12 @@
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;
// The selection end needs to be set before the start, otherwise there
// can be an intermediate non-empty selection between the two, which
// can override the middle-click paste buffer on linux and cause the
// wrong thing to get pasted.
d.input.selectionEnd = end;
d.input.selectionStart = start;
cm.state.fakedLastChar = true;
}
cm.state.pasteIncoming = true;
Expand Down

0 comments on commit 357e941

Please sign in to comment.