From bee4c9df8a96aa29d6a3b5bdafe9524ea213d5f2 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 19 Jun 2014 12:06:09 -0700 Subject: [PATCH] Revert "Select to the end of the last row rather than beginning of row + 1" This reverts commit c5815d2af9e712d6a574aecd1b5f121e8b8b3c42. --- spec/editor-component-spec.coffee | 10 +++++----- src/editor-component.coffee | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 9d0c7a61e..de7439917 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -1052,7 +1052,7 @@ describe "EditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(6))) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(6))) - expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [6, 65]] + expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [7, 0]] describe "when dragging upward", -> it "selects the rows between the start and end of the drag", -> @@ -1060,7 +1060,7 @@ describe "EditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(2))) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(2))) - expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [6, 65]] + expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [7, 0]] describe "when the gutter is shift-clicked and dragged", -> beforeEach -> @@ -1074,7 +1074,7 @@ describe "EditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(8))) nextAnimationFrame() - expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [8, 56]] + expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [9, 0]] describe "when dragging upward", -> it "selects the rows between the end of the drag and the tail of the existing selection", -> @@ -1083,7 +1083,7 @@ describe "EditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(5))) nextAnimationFrame() - expect(editor.getSelectedScreenRange()).toEqual [[4, 4], [5, 30]] + expect(editor.getSelectedScreenRange()).toEqual [[4, 4], [6, 0]] gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(1))) nextAnimationFrame() @@ -1110,7 +1110,7 @@ describe "EditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(8))) nextAnimationFrame() - expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [8, 56]] + expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [9, 0]] describe "focus handling", -> inputNode = null diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 7a2cd0d72..7398f7632 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -524,9 +524,9 @@ EditorComponent = React.createClass @handleDragUntilMouseUp event, (screenPosition) -> dragRow = screenPosition.row if dragRow < clickedRow # dragging up - editor.setSelectedScreenRange([[dragRow, 0], [clickedRow, Infinity]]) + editor.setSelectedScreenRange([[dragRow, 0], [clickedRow + 1, 0]]) else - editor.setSelectedScreenRange([[clickedRow, 0], [dragRow, Infinity]]) + editor.setSelectedScreenRange([[clickedRow, 0], [dragRow + 1, 0]]) onGutterShiftClick: (event) -> {editor} = @props @@ -543,7 +543,7 @@ EditorComponent = React.createClass if dragRow < tailPosition.row # dragging up editor.setSelectedScreenRange([[dragRow, 0], tailPosition]) else - editor.setSelectedScreenRange([tailPosition, [dragRow, Infinity]]) + editor.setSelectedScreenRange([tailPosition, [dragRow + 1, 0]]) onStylesheetsChanged: (stylesheet) -> @refreshScrollbars() if @containsScrollbarSelector(stylesheet)