mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Append line ending if it isn’t present
This commit is contained in:
committed by
Luke Pommersheim
parent
b14f3d8d92
commit
2fc2c074be
@@ -856,8 +856,7 @@ class TextEditor extends Model
|
|||||||
insertPosition = Point.fromObject([startRow - insertDelta])
|
insertPosition = Point.fromObject([startRow - insertDelta])
|
||||||
endPosition = Point.min([endRow + 1], @buffer.getEndPosition())
|
endPosition = Point.min([endRow + 1], @buffer.getEndPosition())
|
||||||
lines = @buffer.getTextInRange([[startRow], endPosition])
|
lines = @buffer.getTextInRange([[startRow], endPosition])
|
||||||
if endPosition.row is lastRow and endPosition.column > 0 and not @buffer.lineEndingForRow(endPosition.row)
|
lines += @buffer.lineEndingForRow(endPosition.row - 1) unless lines[lines.length - 1] is '\n'
|
||||||
lines = "#{lines}\n"
|
|
||||||
|
|
||||||
@buffer.deleteRows(startRow, endRow)
|
@buffer.deleteRows(startRow, endRow)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user