Skip to content

Commit

Permalink
Make sure, that we're not starting a second selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Stadermann authored and marijnh committed Jul 31, 2015
1 parent 4ab7e90 commit b22783d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
focused: false,
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
selectingText: false,
draggingText: false,
highlight: new Delayed(), // stores highlight worker timeout
keySeq: null, // Unfinished key sequence
Expand Down Expand Up @@ -3540,7 +3541,10 @@

switch (e_button(e)) {
case 1:
if (start)
// #3261: make sure, that we're not starting a second selection
if (cm.state.selectingText)
cm.state.selectingText(e);
else if (start)
leftButtonDown(cm, e, start);
else if (e_target(e) == display.scroller)
e_preventDefault(e);
Expand Down Expand Up @@ -3738,6 +3742,7 @@
}

function done(e) {
cm.state.selectingText = false;
counter = Infinity;
e_preventDefault(e);
display.input.focus();
Expand All @@ -3751,6 +3756,7 @@
else extend(e);
});
var up = operation(cm, done);
cm.state.selectingText = up;
on(document, "mousemove", move);
on(document, "mouseup", up);
}
Expand Down

0 comments on commit b22783d

Please sign in to comment.