Fix enabled_layouts in session files not being respected

This commit is contained in:
Kovid Goyal 2018-02-20 10:01:41 +05:30
parent 8f423c6d8f
commit 96d241e9f3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 3 deletions

View File

@ -59,6 +59,8 @@ class Session:
def set_enabled_layouts(self, raw):
self.tabs[-1].enabled_layouts = to_layout_names(raw)
if self.tabs[-1].layout not in self.tabs[-1].enabled_layouts:
self.tabs[-1].layout = self.tabs[-1].enabled_layouts[0]
def set_cwd(self, val):
self.tabs[-1].cwd = val

View File

@ -107,12 +107,12 @@ class Tab: # {{{
return all_layouts[idx](self.os_window_id, self.id, self.opts, self.borders.border_width)
def next_layout(self):
if len(self.opts.enabled_layouts) > 1:
if len(self.enabled_layouts) > 1:
try:
idx = self.opts.enabled_layouts.index(self.current_layout.name)
idx = self.enabled_layouts.index(self.current_layout.name)
except Exception:
idx = -1
nl = self.opts.enabled_layouts[(idx + 1) % len(self.opts.enabled_layouts)]
nl = self.enabled_layouts[(idx + 1) % len(self.enabled_layouts)]
self.current_layout = self.create_layout_object(nl)
self.relayout()