From 8c36d2673b1e80d84ecf5884f0a6c07723ff6511 Mon Sep 17 00:00:00 2001 From: Ivan Zuzak Date: Sat, 30 Aug 2014 20:20:09 +0200 Subject: [PATCH] Select row when clicking the gutter --- spec/editor-component-spec.coffee | 4 ++-- src/editor-component.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index d80396d23..5b30bdbdf 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -1331,9 +1331,9 @@ describe "EditorComponent", -> gutterNode = componentNode.querySelector('.gutter') describe "when the gutter is clicked", -> - it "moves the cursor to the beginning of the clicked row", -> + it "selects the clicked row", -> gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(4))) - expect(editor.getCursorScreenPosition()).toEqual [4, 0] + expect(editor.getSelectedScreenRange()).toEqual [[4, 0], [5, 0]] describe "when the gutter is shift-clicked", -> beforeEach -> diff --git a/src/editor-component.coffee b/src/editor-component.coffee index b14a169b8..17c0f831c 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -649,7 +649,7 @@ EditorComponent = React.createClass {editor} = @props clickedRow = @screenPositionForMouseEvent(event).row - editor.setCursorScreenPosition([clickedRow, 0]) + editor.setSelectedScreenRange([[clickedRow, 0], [clickedRow + 1, 0]]) @handleDragUntilMouseUp event, (screenPosition) -> dragRow = screenPosition.row