Expand selections on shift-click

This commit is contained in:
Nathan Sobo
2017-03-10 09:52:06 -07:00
committed by Antonio Scandurra
parent 35753c3a8d
commit c410309827
2 changed files with 25 additions and 3 deletions

View File

@@ -742,11 +742,12 @@ class TextEditorComponent {
didMouseDownOnLines (event) {
const {model} = this.props
const {detail, ctrlKey, shiftKey, metaKey} = event
const screenPosition = this.screenPositionForMouseEvent(event)
const addOrRemoveSelection = event.metaKey || (event.ctrlKey && this.getPlatform() !== 'darwin')
const addOrRemoveSelection = metaKey || (ctrlKey && this.getPlatform() !== 'darwin')
switch (event.detail) {
switch (detail) {
case 1:
if (addOrRemoveSelection) {
const existingSelection = model.getSelectionAtScreenPosition(screenPosition)
@@ -756,7 +757,11 @@ class TextEditorComponent {
model.addCursorAtScreenPosition(screenPosition)
}
} else {
model.setCursorScreenPosition(screenPosition)
if (shiftKey) {
model.selectToScreenPosition(screenPosition)
} else {
model.setCursorScreenPosition(screenPosition)
}
}
break
case 2: