Only add newline when insert row exceeds last row

Previously if the line before a trailing newline was
duplicated an extra newline would inserted with the
duplicated line.
This commit is contained in:
Kevin Sawicki
2013-02-19 21:01:22 -08:00
parent d27bbee37d
commit dedde7b222
2 changed files with 13 additions and 1 deletions

View File

@@ -421,7 +421,7 @@ class EditSession
bufferRange = new Range([cursorPosition.row], [cursorPosition.row + 1])
insertPosition = new Point(bufferRange.end.row)
if insertPosition.row >= @buffer.getLastRow()
if insertPosition.row > @buffer.getLastRow()
@unfoldCurrentRow() if cursorRowFolded
@buffer.append("\n#{@getTextInBufferRange(bufferRange)}")
@foldCurrentRow() if cursorRowFolded