Move event listener calls from resetDisplay to edit

Fixes #140
This commit is contained in:
Corey Johnson & Nathan Sobo 2013-04-24 11:29:46 -07:00
parent 2a6c4b04b1
commit 24ce415283
2 changed files with 20 additions and 8 deletions

View File

@ -2575,3 +2575,15 @@ describe "Editor", ->
editor.on 'editor:will-be-removed', willBeRemovedHandler
editor.getPane().destroyActiveItem()
expect(willBeRemovedHandler).toHaveBeenCalled()
describe "when setInvisibles is toggled (regression)", ->
it "renders inserted newlines properly", ->
editor.setShowInvisibles(true)
editor.setCursorBufferPosition([0, 0])
editor.attachToDom(heightInLines: 20)
editor.setShowInvisibles(false)
editor.insertText("\n")
for rowNumber in [1..5]
expect(editor.lineElementForScreenRow(rowNumber).text()).toBe buffer.lineForRow(rowNumber)

View File

@ -826,6 +826,14 @@ class Editor extends View
@activeEditSession.on "grammar-changed.editor", =>
@trigger 'editor:grammar-changed'
@activeEditSession.on 'selection-added.editor', (selection) =>
@newCursors.push(selection.cursor)
@newSelections.push(selection)
@requestDisplayUpdate()
@activeEditSession.on 'screen-lines-changed.editor', (e) =>
@handleScreenLinesChange(e)
@trigger 'editor:path-changed'
@resetDisplay()
@ -1178,14 +1186,6 @@ class Editor extends View
@removeAllCursorAndSelectionViews()
@updateLayerDimensions()
@setScrollPositionFromActiveEditSession()
@activeEditSession.on 'selection-added.editor', (selection) =>
@newCursors.push(selection.cursor)
@newSelections.push(selection)
@requestDisplayUpdate()
@activeEditSession.on 'screen-lines-changed.editor', (e) => @handleScreenLinesChange(e)
@newCursors = @activeEditSession.getCursors()
@newSelections = @activeEditSession.getSelections()
@updateDisplay(suppressAutoScroll: true)