From 40af34ad7cf44da77a1d9ed8f63bee5d6790e8cc Mon Sep 17 00:00:00 2001 From: Mathieu Pasquet Date: Thu, 19 Sep 2013 00:19:42 +0200 Subject: [PATCH] Fix #2372 (traceback on space in roster after disconnect) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit selected_row wasn’t reset --- src/core.py | 1 + src/tabs.py | 1 - src/windows.py | 5 ++++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core.py b/src/core.py index 20e09b39..194c6f88 100644 --- a/src/core.py +++ b/src/core.py @@ -3447,6 +3447,7 @@ class Core(object): """ When we are disconnected from remote server """ + roster.modified() for tab in self.tabs: if isinstance(tab, tabs.MucTab): tab.disconnect() diff --git a/src/tabs.py b/src/tabs.py index db534a72..c4615f0c 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -2963,7 +2963,6 @@ class RosterInfoTab(Tab): while not found_group and pos >= 0: row = self.roster_win.roster_cache[pos] pos -= 1 - log.debug(row) if isinstance(row, RosterGroup): found_group = True group = row.name diff --git a/src/windows.py b/src/windows.py index 551f20af..5e14c3d4 100644 --- a/src/windows.py +++ b/src/windows.py @@ -2007,6 +2007,8 @@ class RosterWin(Win): with g_lock: # make sure we are within bounds self.move_cursor_up((self.roster_len + self.pos) if self.pos >= self.roster_len else 0) + if not self.roster_cache: + self.selected_row = None self._win.erase() self._win.move(0, 0) self.draw_roster_information(roster) @@ -2016,8 +2018,9 @@ class RosterWin(Win): if self.start_pos+self.height <= self.pos+2: self.scroll_down(self.pos - self.start_pos - self.height + (self.height//2)) # draw the roster from the cache - for item in self.roster_cache[self.start_pos-1:self.start_pos+self.height]: + roster_view = self.roster_cache[self.start_pos-1:self.start_pos+self.height] + for item in roster_view: draw_selected = False if y -2 + self.start_pos == self.pos: draw_selected = True