🐛 Update cursors after model changes

/cc: @nathansobo
This commit is contained in:
Antonio Scandurra
2015-05-29 15:21:00 +02:00
parent b4dfb2a31b
commit 9b4d62b687
2 changed files with 14 additions and 0 deletions

View File

@@ -1108,6 +1108,19 @@ describe "TextEditorPresenter", ->
expect(stateForCursor(presenter, 3)).toEqual {top: 0, left: 12 * 10, width: 10, height: 10}
expect(stateForCursor(presenter, 4)).toEqual {top: 8 * 10 - 50, left: 4 * 10, width: 10, height: 10}
it "updates when ::scrollTop changes after the model was changed", ->
editor.setCursorBufferPosition([8, 22])
presenter = buildPresenter(explicitHeight: 50, scrollTop: 10 * 8)
expect(stateForCursor(presenter, 0)).toEqual {top: 0, left: 10 * 22, width: 10, height: 10}
expectStateUpdate presenter, ->
editor.getBuffer().deleteRow(12)
editor.getBuffer().deleteRow(11)
editor.getBuffer().deleteRow(10)
expect(stateForCursor(presenter, 0)).toEqual {top: 20, left: 10 * 22, width: 10, height: 10}
it "updates when ::explicitHeight changes", ->
editor.setSelectedBufferRanges([
[[1, 2], [1, 2]],

View File

@@ -115,6 +115,7 @@ class TextEditorPresenter
@shouldUpdateScrollbarsState = true
@shouldUpdateContentState = true
@shouldUpdateDecorations = true
@shouldUpdateCursorsState = true
@shouldUpdateTilesState = true
@shouldUpdateLineNumberGutterState = true
@shouldUpdateLineNumbersState = true