Merge branch 'master' into global-find

This commit is contained in:
Corey Johnson
2012-07-13 09:36:21 -07:00
5 changed files with 36 additions and 24 deletions

View File

@@ -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

View File

@@ -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()