mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Fix bug where edit sessions were not properly restored on refresh
This commit is contained in:
parent
086b33f606
commit
5b11762989
@ -48,7 +48,8 @@ describe "Editor", ->
|
||||
rootView.height(8 * editor.lineHeight)
|
||||
rootView.width(50 * editor.charWidth)
|
||||
|
||||
editor.setCursorScreenPosition([5, 20])
|
||||
editor.edit(rootView.project.open('two-hundred.txt'))
|
||||
editor.setCursorScreenPosition([5, 1])
|
||||
editor.scrollTop(1.5 * editor.lineHeight)
|
||||
editor.scrollView.scrollLeft(44)
|
||||
|
||||
@ -60,11 +61,11 @@ describe "Editor", ->
|
||||
expect(editor.serialize).toHaveBeenCalled()
|
||||
expect(Editor.deserialize).toHaveBeenCalled()
|
||||
|
||||
|
||||
expect(newEditor.buffer).toBe editor.buffer
|
||||
expect(newEditor.getCursorScreenPosition()).toEqual editor.getCursorScreenPosition()
|
||||
expect(newEditor.editSessions[0]).toEqual(editor.editSessions[0])
|
||||
expect(newEditor.editSessions[0]).not.toBe(editor.editSessions[0])
|
||||
expect(newEditor.editSessions).toEqual(editor.editSessions)
|
||||
expect(newEditor.activeEditSession).toEqual(editor.activeEditSession)
|
||||
expect(newEditor.getActiveEditSessionIndex()).toEqual(editor.getActiveEditSessionIndex())
|
||||
|
||||
newEditor.height(editor.height())
|
||||
newEditor.width(editor.width())
|
||||
|
@ -48,10 +48,8 @@ class Editor extends View
|
||||
|
||||
@deserialize: (state, rootView) ->
|
||||
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, editor, rootView)
|
||||
|
||||
editSession = editSessions[state.activeEditSessionIndex]
|
||||
editor = new Editor(editSession: editSession, mini: state.mini)
|
||||
editor.editSession = editSessions
|
||||
editor = new Editor(editSession: editSessions[state.activeEditSessionIndex], mini: state.mini)
|
||||
editor.editSessions = editSessions
|
||||
editor.isFocused = state.isFocused
|
||||
editor
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user