Commit 8634b5ea authored by mathieui's avatar mathieui

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.
parent 89194356
......@@ -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:
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment