mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Don't move down a line if it's the last buffer row
This commit is contained in:
@@ -2875,6 +2875,13 @@ describe "TextEditor", ->
|
||||
expect(editor.lineTextForBufferRow(1)).toBe "1"
|
||||
expect(editor.lineTextForBufferRow(2)).toBe "2"
|
||||
|
||||
describe "when the line is the last buffer row", ->
|
||||
it "doesn't move it", ->
|
||||
editor.setText("abc\ndef")
|
||||
editor.setCursorBufferPosition([1, 0])
|
||||
editor.moveLineDown()
|
||||
expect(editor.getText()).toBe("abc\ndef")
|
||||
|
||||
describe ".insertText(text)", ->
|
||||
describe "when there is a single selection", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -1068,7 +1068,7 @@ class TextEditor extends Model
|
||||
|
||||
# Delete lines spanned by selection and insert them on the following correct buffer row
|
||||
lines = @buffer.getTextInRange(linesRange)
|
||||
if linesRange.end.row is @buffer.getLastRow()
|
||||
if followingRow - 1 is @buffer.getLastRow()
|
||||
lines = "\n#{lines}"
|
||||
|
||||
@buffer.insert([followingRow, 0], lines)
|
||||
|
||||
Reference in New Issue
Block a user