Restore selection when undoing an insert newline below

This commit is contained in:
Kevin Sawicki
2013-02-20 14:01:48 -08:00
parent b14099c10d
commit 881efd9c5d
2 changed files with 11 additions and 2 deletions

View File

@@ -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()

View File

@@ -171,8 +171,9 @@ class EditSession
@insertText('\n')
insertNewlineBelow: ->
@moveCursorToEndOfLine()
@insertNewline()
@transact =>
@moveCursorToEndOfLine()
@insertNewline()
insertNewlineAbove: ->
@transact =>