mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Merge branch 'master' into global-find
This commit is contained in:
@@ -13,8 +13,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)
|
||||
@@ -66,6 +66,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
|
||||
@@ -519,17 +519,20 @@ class Editor extends View
|
||||
@updateCursorViews()
|
||||
@updateRenderedLines()
|
||||
|
||||
newSplitEditor: ->
|
||||
new Editor { editSession: @activeEditSession.copy() }
|
||||
|
||||
splitLeft: ->
|
||||
@pane()?.splitLeft(@copy()).wrappedView
|
||||
@pane()?.splitLeft(@newSplitEditor()).wrappedView
|
||||
|
||||
splitRight: ->
|
||||
@pane()?.splitRight(@copy()).wrappedView
|
||||
@pane()?.splitRight(@newSplitEditor()).wrappedView
|
||||
|
||||
splitUp: ->
|
||||
@pane()?.splitUp(@copy()).wrappedView
|
||||
@pane()?.splitUp(@newSplitEditor()).wrappedView
|
||||
|
||||
splitDown: ->
|
||||
@pane()?.splitDown(@copy()).wrappedView
|
||||
@pane()?.splitDown(@newSplitEditor()).wrappedView
|
||||
|
||||
pane: ->
|
||||
@parent('.pane').view()
|
||||
@@ -650,7 +653,11 @@ class Editor extends View
|
||||
@renderedLines.css('padding-bottom', heightOfRenderedLines)
|
||||
|
||||
adjustWidthOfRenderedLines: ->
|
||||
@renderedLines.width(@charWidth * @maxScreenLineLength())
|
||||
width = @charWidth * @maxScreenLineLength()
|
||||
if width > @scrollView.width()
|
||||
@renderedLines.width(width)
|
||||
else
|
||||
@renderedLines.width(@scrollView.width())
|
||||
|
||||
handleScrollHeightChange: ->
|
||||
scrollHeight = @lineHeight * @screenLineCount()
|
||||
|
||||
Reference in New Issue
Block a user