summaryrefslogtreecommitdiff
path: root/poezio
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-07-21 21:36:46 +0200
committermathieui <mathieui@mathieui.net>2018-07-21 21:38:26 +0200
commit534ba14d5c898d50ffcdfd8539eedf10165f7fd9 (patch)
tree5e4a818966ebb55aa3a71925a3a0e0e544138d94 /poezio
parent784f2d287623d2dbaac16343d5bf10b3a68bd0f7 (diff)
downloadpoezio-534ba14d5c898d50ffcdfd8539eedf10165f7fd9.tar.gz
poezio-534ba14d5c898d50ffcdfd8539eedf10165f7fd9.tar.bz2
poezio-534ba14d5c898d50ffcdfd8539eedf10165f7fd9.tar.xz
poezio-534ba14d5c898d50ffcdfd8539eedf10165f7fd9.zip
Fix /reorder
Diffstat (limited to 'poezio')
-rw-r--r--poezio/core/tabs.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/poezio/core/tabs.py b/poezio/core/tabs.py
index 3adaf478..91a10497 100644
--- a/poezio/core/tabs.py
+++ b/poezio/core/tabs.py
@@ -141,20 +141,16 @@ class Tabs:
self._tab_names[tab.name] = tab
self._update_numbers()
- def replace_tabs(self, new_tabs: List[tabs.Tab]):
+ def replace_tabs(self, new_tabs: List[tabs.Tab]) -> bool:
"""
Replace the current tab list with another, and
rebuild the mappings.
"""
+ if self._current_tab not in new_tabs:
+ return False
self._tabs = new_tabs
self._rebuild()
- current_tab = self.current_tab
- try:
- idx = self._tabs.index(current_tab)
- self._current_index = idx
- except ValueError:
- self._current_index = 0
- self._current_tab = self._tabs[0]
+ return True
def _inc_cursor(self):
self._current_index = (self._current_index + 1) % len(self._tabs)