Fixes selection flicker on click

This commit is contained in:
Dan Kaplun 2014-06-16 20:19:28 -04:00
parent 90a2469857
commit 4dc4cca34e

View File

@ -677,7 +677,11 @@ Editor.prototype._initHandlers = function () {
}
self.select({x: startX, y: mouse.y}, {x: endX, y: mouse.y});
} else {
if (!self.data.mouseDown) self.startSelection(mouse);
if (!self.data.mouseDown) {
self.data.hideSelection = true;
self.startSelection(mouse);
self.data.hideSelection = false;
}
self.data.mouseDown = true;
}
}
@ -802,7 +806,7 @@ Editor.prototype.render = function () {
line.slice(markupScrollX, markup.index(line, x + size.x)) +
_.repeat(' ', size.x).join('');
if (selectionStyle && visibleSelection.start.y <= y && y <= visibleSelection.end.y) {
if (!self.data.hideSelection && selectionStyle && visibleSelection.start.y <= y && y <= visibleSelection.end.y) {
line = markup(line, selectionStyle,
y === visibleSelection.start.y ? visibleSelection.start.x - x : 0,
y === visibleSelection.end.y ? visibleSelection.end.x - x : Infinity);