From 30aa47026d102ea86b80172b4513db17dd4f5bb0 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 21 Aug 2014 10:40:16 -0700 Subject: [PATCH] Do not move cursor when interacting with horiz scrollbar Fix #3284 --- spec/editor-component-spec.coffee | 6 ++++++ src/editor-component.coffee | 1 + 2 files changed, 7 insertions(+) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 62f8eac19..a509163bd 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -1318,6 +1318,12 @@ describe "EditorComponent", -> linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([4, 8]), {target})) expect(editor.isFoldedAtBufferRow 4).toBe false + describe "when the horizontal scrollbar is interacted with", -> + it "clicking on the scrollbar does not move the cursor", -> + target = horizontalScrollbarNode + linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([4, 8]), {target})) + expect(editor.getCursorScreenPosition()).toEqual [0, 0] + describe "mouse interactions on the gutter", -> gutterNode = null diff --git a/src/editor-component.coffee b/src/editor-component.coffee index dd2191136..d85de3f4b 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -613,6 +613,7 @@ EditorComponent = React.createClass onMouseDown: (event) -> return unless event.button is 0 # only handle the left mouse button + return if event.target?.classList.contains('horizontal-scrollbar') {editor} = @props {detail, shiftKey, metaKey, ctrlKey} = event