summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-07-22 19:56:07 +0200
committermathieui <mathieui@mathieui.net>2016-07-22 19:56:07 +0200
commit8634b5ea66cd8fb305d41a2680c66a7d4fcde73c (patch)
treeb8b70bddee730c87e43c31cd826fa2bd1d2d0db3
parent89194356ee3b61c6c630d15b8aeb94c91cbacba4 (diff)
downloadpoezio-8634b5ea66cd8fb305d41a2680c66a7d4fcde73c.tar.gz
poezio-8634b5ea66cd8fb305d41a2680c66a7d4fcde73c.tar.bz2
poezio-8634b5ea66cd8fb305d41a2680c66a7d4fcde73c.tar.xz
poezio-8634b5ea66cd8fb305d41a2680c66a7d4fcde73c.zip
Fix a bug with the _close_tab shortcut
on_close wasn’t used correctly everywhere. Also make the "close" commands for each tab specific to themselves, rather than taking the current tab for closure.
-rw-r--r--poezio/core/core.py2
-rw-r--r--poezio/tabs/bookmarkstab.py4
-rw-r--r--poezio/tabs/conversationtab.py2
-rw-r--r--poezio/tabs/listtab.py1
-rw-r--r--poezio/tabs/muctab.py6
-rw-r--r--poezio/tabs/privatetab.py3
-rw-r--r--poezio/tabs/xmltab.py3
7 files changed, 13 insertions, 8 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 3cc02979..d4a5c060 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1346,9 +1346,9 @@ class Core(object):
tab = self.current_tab()
if isinstance(tab, tabs.RosterInfoTab):
return # The tab 0 should NEVER be closed
+ tab.on_close()
del tab.key_func # Remove self references
del tab.commands # and make the object collectable
- tab.on_close()
nb = tab.nb
if was_current:
if self.previous_tab_nb != nb:
diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py
index 053e45dd..5416712b 100644
--- a/poezio/tabs/bookmarkstab.py
+++ b/poezio/tabs/bookmarkstab.py
@@ -58,7 +58,7 @@ class BookmarksTab(Tab):
self.removed_bookmarks.append(current)
def on_cancel(self):
- self.core.close_tab()
+ self.core.close_tab(self)
return True
def on_save(self):
@@ -85,7 +85,7 @@ class BookmarksTab(Tab):
self.core.information('Remote bookmarks not saved.', 'Error')
log.debug('alerte %s', str(stanza_storage(self.bookmarks.bookmarks)))
self.bookmarks.save(self.core.xmpp, callback=send_cb)
- self.core.close_tab()
+ self.core.close_tab(self)
return True
def on_input(self, key, raw=False):
diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py
index 99c4b122..469ef28a 100644
--- a/poezio/tabs/conversationtab.py
+++ b/poezio/tabs/conversationtab.py
@@ -207,7 +207,7 @@ class ConversationTab(OneToOneTab):
@command_args_parser.ignored
def command_unquery(self):
- self.core.close_tab()
+ self.core.close_tab(self)
@command_args_parser.quoted(0, 1)
def command_version(self, args):
diff --git a/poezio/tabs/listtab.py b/poezio/tabs/listtab.py
index c99bd3bd..18ee1da4 100644
--- a/poezio/tabs/listtab.py
+++ b/poezio/tabs/listtab.py
@@ -111,7 +111,6 @@ class ListTab(Tab):
self.input.do_command("/") # we add the slash
def close(self, arg=None):
- self.input.on_delete()
self.core.close_tab(self)
def set_error(self, msg, code, body):
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index e0f3b6e2..281237ad 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -624,7 +624,11 @@ class MucTab(ChatTab):
/close [msg]
"""
self.command_part(msg)
- self.core.close_tab()
+ self.core.close_tab(self)
+
+ def on_close(self):
+ super().on_close()
+ self.command_part('')
@command_args_parser.quoted(1, 1)
def command_query(self, args):
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index c8c80f19..7a132167 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -96,6 +96,7 @@ class PrivateTab(OneToOneTab):
self.core.information('Unable to write in the log file', 'Error')
def on_close(self):
+ super().on_close()
self.parent_muc.privates.remove(self)
def completion(self):
@@ -188,7 +189,7 @@ class PrivateTab(OneToOneTab):
"""
/unquery
"""
- self.core.close_tab()
+ self.core.close_tab(self)
@command_args_parser.quoted(0, 1)
def command_version(self, args):
diff --git a/poezio/tabs/xmltab.py b/poezio/tabs/xmltab.py
index 937ab0f9..3fdaffc7 100644
--- a/poezio/tabs/xmltab.py
+++ b/poezio/tabs/xmltab.py
@@ -303,7 +303,7 @@ class XMLTab(Tab):
return self.key_func[key]()
def close(self, arg=None):
- self.core.close_tab()
+ self.core.close_tab(self)
def resize(self):
self.need_resize = False
@@ -348,6 +348,7 @@ class XMLTab(Tab):
curses.curs_set(0)
def on_close(self):
+ super().on_close()
self.command_clear('')
self.core.xml_tab = False