mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
On clicks, only move cursor if there is one cursor without a selection
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user