Call adjustSplitPanes after setting window state

This commit is contained in:
Nathan Sobo
2012-04-11 12:59:29 -06:00
parent 56e98aece5
commit 284f982e2c
2 changed files with 11 additions and 0 deletions

View File

@@ -87,6 +87,13 @@ describe "RootView", ->
expect(editor4.buffer.path).toBe require.resolve('fixtures/sample.txt')
expect(editor4.getCursorScreenPosition()).toEqual [0, 2]
# ensure adjustSplitPanes is called
expect(editor1.width()).toBeGreaterThan 0
expect(editor2.width()).toBeGreaterThan 0
expect(editor3.width()).toBeGreaterThan 0
expect(editor4.width()).toBeGreaterThan 0
describe "split editor panes", ->
editor1 = null

View File

@@ -90,9 +90,11 @@ class RootView extends View
@getWindowState($(elt))
setWindowState: (windowState, parent) ->
adjustSplitPanes = false
unless parent
@panes.empty()
@editors = []
adjustSplitPanes = true
parent = @panes
switch windowState.shift()
@@ -111,6 +113,8 @@ class RootView extends View
for child in windowState
@setWindowState(child, column)
@adjustSplitPanes() if adjustSplitPanes
addPane: (view, sibling, axis, side) ->
unless sibling.parent().hasClass(axis)
container = $$ -> @div class: axis