now possible to always move lines down at the end of the file

This commit is contained in:
Luke Pommersheim
2015-08-23 19:24:39 +02:00
parent b394b2c903
commit 7bb8586905

View File

@@ -886,11 +886,6 @@ class TextEditor extends Model
moveLineDown: ->
selections = @getSelectedBufferRanges()
selections.sort (a, b) -> a.compare(b)
if selections[selections.length - 1].start.row is @buffer.getLastRow()
return
if selections[selections.length - 1].start.row is @getLastBufferRow() and @buffer.getLastLine() is ''
return
@transact =>
newSelectionRanges = []
@@ -931,6 +926,8 @@ class TextEditor extends Model
# Delete lines spanned by selection and insert them on the following correct buffer row
insertPosition = new Point(selection.translate([insertDelta, 0]).start.row, 0)
lines = @buffer.getTextInRange(linesRange)
if linesRange.end.row is @buffer.getLastRow()
lines = "\n#{lines}"
@buffer.delete(linesRange)
@buffer.insert(insertPosition, lines)