mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Added EditSession.copy()
Also, EditSession only needs a project to be deserialized
This commit is contained in:
@@ -12,8 +12,8 @@ module.exports =
|
||||
class EditSession
|
||||
@idCounter: 1
|
||||
|
||||
@deserialize: (state, editor, rootView) ->
|
||||
session = rootView.project.open(state.buffer)
|
||||
@deserialize: (state, project) ->
|
||||
session = project.open(state.buffer)
|
||||
session.setScrollTop(state.scrollTop)
|
||||
session.setScrollLeft(state.scrollLeft)
|
||||
session.setCursorScreenPosition(state.cursorScreenPosition)
|
||||
@@ -65,6 +65,9 @@ class EditSession
|
||||
scrollLeft: @getScrollLeft()
|
||||
cursorScreenPosition: @getCursorScreenPosition().serialize()
|
||||
|
||||
copy: ->
|
||||
EditSession.deserialize(@serialize(), @project)
|
||||
|
||||
isEqual: (other) ->
|
||||
return false unless other instanceof EditSession
|
||||
@buffer == other.buffer and
|
||||
|
||||
@@ -46,7 +46,7 @@ class Editor extends View
|
||||
lineOverdraw: 100
|
||||
|
||||
@deserialize: (state, rootView) ->
|
||||
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, editor, rootView)
|
||||
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, rootView.project)
|
||||
editor = new Editor(editSession: editSessions[state.activeEditSessionIndex], mini: state.mini)
|
||||
editor.editSessions = editSessions
|
||||
editor.isFocused = state.isFocused
|
||||
@@ -520,8 +520,7 @@ class Editor extends View
|
||||
@updateRenderedLines()
|
||||
|
||||
newSplitEditor: ->
|
||||
editSession = EditSession.deserialize(@activeEditSession.serialize(), this, @rootView())
|
||||
new Editor { editSession }
|
||||
new Editor { editSession: @activeEditSession.copy() }
|
||||
|
||||
splitLeft: ->
|
||||
@pane()?.splitLeft(@newSplitEditor()).wrappedView
|
||||
|
||||
Reference in New Issue
Block a user