Fix a refresh bug

On xmltab and listtab, the help text would be displayed in the input
after closing the tab.
This commit is contained in:
mathieui 2016-06-11 13:47:49 +02:00
parent 2225d13ad1
commit 7072b8f635
3 changed files with 8 additions and 3 deletions

View file

@ -90,6 +90,7 @@ class Tab(object):
if not hasattr(self, 'name'): if not hasattr(self, 'name'):
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self.input = None self.input = None
self.closed = False
self._state = 'normal' self._state = 'normal'
self._prev_state = None self._prev_state = None
@ -404,6 +405,7 @@ class Tab(object):
""" """
if self.input: if self.input:
self.input.on_delete() self.input.on_delete()
self.closed = True
def matching_names(self): def matching_names(self):
""" """

View file

@ -141,6 +141,8 @@ class ListTab(Tab):
@refresh_wrapper.always @refresh_wrapper.always
def reset_help_message(self, _=None): def reset_help_message(self, _=None):
if self.closed:
return True
curses.curs_set(0) curses.curs_set(0)
self.input = self.default_help_message self.input = self.default_help_message
self.input.resize(1, self.width, self.height-1, 0) self.input.resize(1, self.width, self.height-1, 0)

View file

@ -20,7 +20,7 @@ from . import Tab
import text_buffer import text_buffer
import windows import windows
from xhtml import clean_text from xhtml import clean_text
from decorators import command_args_parser from decorators import command_args_parser, refresh_wrapper
from common import safeJID from common import safeJID
@ -256,12 +256,13 @@ class XMLTab(Tab):
self.input.resize(1, self.width, self.height-1, 0) self.input.resize(1, self.width, self.height-1, 0)
self.input.do_command("/") # we add the slash self.input.do_command("/") # we add the slash
@refresh_wrapper.always
def reset_help_message(self, _=None): def reset_help_message(self, _=None):
if self.closed:
return True
if self.core.current_tab() is self: if self.core.current_tab() is self:
curses.curs_set(0) curses.curs_set(0)
self.input = self.default_help_message self.input = self.default_help_message
self.input.refresh()
self.core.doupdate()
return True return True
def on_scroll_up(self): def on_scroll_up(self):