Only delete to end row when greater than start row

Closes #442
This commit is contained in:
Kevin Sawicki 2013-03-21 17:07:36 -07:00
parent be9ffc499f
commit f8ffe1c408
2 changed files with 13 additions and 1 deletions

View File

@ -1955,6 +1955,18 @@ describe "EditSession", ->
expect(buffer.getLineCount()).toBe(1)
expect(buffer.getText()).toBe('')
describe "when soft wrap is enabled", ->
it "deletes the entire line that the cursor is on", ->
editSession.setSoftWrapColumn(10)
editSession.setCursorBufferPosition([6])
line7 = buffer.lineForRow(7)
count = buffer.getLineCount()
expect(buffer.lineForRow(6)).not.toBe(line7)
editSession.deleteLine()
expect(buffer.lineForRow(6)).toBe(line7)
expect(buffer.getLineCount()).toBe(count - 1)
describe ".transpose()", ->
it "swaps two characters", ->
editSession.buffer.setText("abc")

View File

@ -271,7 +271,7 @@ class Selection
if @isEmpty()
start = @cursor.getScreenRow()
range = @editSession.bufferRowsForScreenRows(start, start + 1)
if range[1]
if range[1] > range[0]
@editSession.buffer.deleteRows(range[0], range[1] - 1)
else
@editSession.buffer.deleteRow(range[0])