Select to the end of the last row rather than beginning of row + 1

This commit is contained in:
Ben Ogle 2014-06-18 18:17:29 -07:00 committed by Ben Ogle
parent 77717d3eff
commit c5815d2af9
2 changed files with 8 additions and 8 deletions

View File

@ -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], [7, 0]]
expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [6, 65]]
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], [7, 0]]
expect(editor.getSelectedScreenRange()).toEqual [[2, 0], [6, 65]]
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], [9, 0]]
expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [8, 56]]
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], [6, 0]]
expect(editor.getSelectedScreenRange()).toEqual [[4, 4], [5, 30]]
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], [9, 0]]
expect(editor.getSelectedScreenRange()).toEqual [[3, 4], [8, 56]]
describe "focus handling", ->
inputNode = null

View File

@ -524,9 +524,9 @@ EditorComponent = React.createClass
@handleDragUntilMouseUp event, (screenPosition) ->
dragRow = screenPosition.row
if dragRow < clickedRow # dragging up
editor.setSelectedScreenRange([[dragRow, 0], [clickedRow + 1, 0]])
editor.setSelectedScreenRange([[dragRow, 0], [clickedRow, Infinity]])
else
editor.setSelectedScreenRange([[clickedRow, 0], [dragRow + 1, 0]])
editor.setSelectedScreenRange([[clickedRow, 0], [dragRow, Infinity]])
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 + 1, 0]])
editor.setSelectedScreenRange([tailPosition, [dragRow, Infinity]])
onStylesheetsChanged: (stylesheet) ->
@refreshScrollbars() if @containsScrollbarSelector(stylesheet)