(should) Fix #2175 ; prevent bugs caused by tab gaps
This commit is contained in:
parent
9f7a16141a
commit
4f084671d3
2 changed files with 11 additions and 2 deletions
|
@ -1012,6 +1012,10 @@ class Core(object):
|
|||
if config.get('create_gaps', 'false').lower() == 'true':
|
||||
if nb >= len(self.tabs) - 1:
|
||||
self.tabs.remove(tab)
|
||||
nb -= 1
|
||||
while not self.tabs[nb]: # remove the trailing gaps
|
||||
self.tabs.pop()
|
||||
nb -= 1
|
||||
else:
|
||||
self.tabs[nb] = tabs.GapTab()
|
||||
else:
|
||||
|
@ -1506,6 +1510,8 @@ class Core(object):
|
|||
self.current_tab().on_lose_focus()
|
||||
if isinstance(nb, int):
|
||||
if 0 <= nb < len(self.tabs):
|
||||
if not self.tabs[nb]:
|
||||
return
|
||||
self.current_tab_nb = nb
|
||||
else:
|
||||
for tab in self.tabs:
|
||||
|
|
|
@ -269,7 +269,7 @@ class Tab(object):
|
|||
"""
|
||||
Called on each screen refresh (when something has changed)
|
||||
"""
|
||||
raise NotImplementedError
|
||||
pass
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
|
@ -389,6 +389,9 @@ class GapTab(Tab):
|
|||
def get_name(self):
|
||||
return ''
|
||||
|
||||
def refresh(self):
|
||||
log.debug('WARNING: refresh() called on a gap tab, this should not happen')
|
||||
|
||||
class ChatTab(Tab):
|
||||
"""
|
||||
A tab containing a chat of any type.
|
||||
|
@ -611,7 +614,7 @@ class ChatTab(Tab):
|
|||
return self._text_buffer.messages
|
||||
|
||||
def command_say(self, line):
|
||||
raise NotImplementedError
|
||||
pass
|
||||
|
||||
def on_line_up(self):
|
||||
return self.text_win.scroll_up(1)
|
||||
|
|
Loading…
Reference in a new issue