diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 98169e109..51a1fa12f 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -1015,6 +1015,14 @@ describe "EditSession", -> expect(cursor2.getBufferPosition()).toEqual [8,0] describe ".insertNewlineBelow()", -> + describe "when the operation is undone", -> + it "places the cursor back at the previous location", -> + editSession.setCursorBufferPosition([0,2]) + editSession.insertNewlineBelow() + expect(editSession.getCursorBufferPosition()).toEqual [1,0] + editSession.undo() + expect(editSession.getCursorBufferPosition()).toEqual [0,2] + xit "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", -> editSession.setAutoIndent(true) editSession.insertNewlineBelow() diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 326d5dd4b..77e8360f2 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -171,8 +171,9 @@ class EditSession @insertText('\n') insertNewlineBelow: -> - @moveCursorToEndOfLine() - @insertNewline() + @transact => + @moveCursorToEndOfLine() + @insertNewline() insertNewlineAbove: -> @transact =>