Skip to content

Commit

Permalink
do not release mouse if command doesn't modify the selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Dec 26, 2017
1 parent a11bb67 commit 8102837
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ace/mouse/mouse_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var MouseHandler = function(editor) {
};

var onCaptureEnd = function(e) {
editor.commands.off("exec", onOperationEnd);
editor.off("beforeEndOperation", onOperationEnd);
clearInterval(timerId);
onCaptureInterval();
self[self.state + "End"] && self[self.state + "End"](e);
Expand All @@ -187,11 +187,14 @@ var MouseHandler = function(editor) {
var onOperationEnd = function(e) {
// some touchpads fire mouseup event after a slight delay,
// which can cause problems if user presses a keyboard shortcut quickly
if (editor.curOp.command.name)
if (editor.curOp.command.name && editor.curOp.selectionChanged) {
self[self.state + "End"] && self[self.state + "End"]();
self.state = "";
self.releaseMouse();
}
};

editor.commands.on("exec", onOperationEnd);
editor.on("beforeEndOperation", onOperationEnd);

self.$onCaptureMouseMove = onMouseMove;
self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
Expand Down

0 comments on commit 8102837

Please sign in to comment.