On clicks, only move cursor if there is one cursor without a selection

This commit is contained in:
Wliu
2017-12-05 23:11:45 +01:00
parent 4f73e81080
commit 69214dc26a

View File

@@ -1758,11 +1758,12 @@ class TextEditorComponent {
const screenPosition = this.screenPositionForMouseEvent(event)
// All clicks should set the cursor position, but only left-clicks should
// have additional logic.
// On macOS, ctrl-click brings up the context menu so also handle that case.
if (button !== 0 || (platform === 'darwin' && ctrlKey)) {
model.setCursorScreenPosition(screenPosition, {autoscroll: false})
// Set cursor position only if there is one cursor with no selection
const ranges = model.getSelectedBufferRanges()
if (ranges.length === 1 && ranges[0].isEmpty()) {
model.setCursorScreenPosition(screenPosition, {autoscroll: false})
}
// On Linux, pasting happens on middle click. A textInput event with the
// contents of the selection clipboard will be dispatched by the browser