diff options
-rw-r--r-- | src/tabs.py | 5 | ||||
-rw-r--r-- | src/windows.py | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/tabs.py b/src/tabs.py index 0d99e19c..f8a6ecac 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -2559,25 +2559,28 @@ class RosterInfoTab(Tab): while not isinstance(self.roster_win.get_selected_row(), Contact): if not self.roster_win.move_cursor_up(): break + self.roster_win.refresh(roster) def move_cursor_to_next_contact(self): self.roster_win.move_cursor_down() - self.roster_win.refresh(roster) while not isinstance(self.roster_win.get_selected_row(), Contact): if not self.roster_win.move_cursor_down(): break + self.roster_win.refresh(roster) def move_cursor_to_prev_group(self): self.roster_win.move_cursor_up() while not isinstance(self.roster_win.get_selected_row(), RosterGroup): if not self.roster_win.move_cursor_up(): break + self.roster_win.refresh(roster) def move_cursor_to_next_group(self): self.roster_win.move_cursor_down() while not isinstance(self.roster_win.get_selected_row(), RosterGroup): if not self.roster_win.move_cursor_down(): break + self.roster_win.refresh(roster) def on_scroll_down(self): return self.roster_win.move_cursor_down(self.height // 2) diff --git a/src/windows.py b/src/windows.py index 4cf358a0..5168f9c7 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1576,6 +1576,7 @@ class RosterWin(Win): self.start_pos = 1 # position of the start of the display self.roster_len = 0 self.selected_row = None + self.roster_cache = [] def move_cursor_down(self, number=1): """ @@ -1630,8 +1631,9 @@ class RosterWin(Win): We get the roster object """ log.debug('Refresh: %s',self.__class__.__name__) + self.roster_cache = [] with g_lock: - self.roster_len = len(roster) + self.roster_len = len(roster); while self.roster_len and self.pos >= self.roster_len: self.move_cursor_up() self._win.erase() @@ -1650,6 +1652,7 @@ class RosterWin(Win): self.selected_row = group if y >= self.start_pos: self.draw_group(y-self.start_pos+1, group, y-1==self.pos) + self.roster_cache.append(group) y += 1 if group.folded: continue @@ -1662,6 +1665,8 @@ class RosterWin(Win): break if y >= self.start_pos: self.draw_contact_line(y-self.start_pos+1, contact, y-1==self.pos) + log.debug('ammend: %s',contact.bare_jid) + self.roster_cache.append(contact) y += 1 if not contact.folded: for resource in contact.get_resources(): @@ -1671,6 +1676,7 @@ class RosterWin(Win): break if y >= self.start_pos: self.draw_resource_line(y-self.start_pos+1, resource, y-1==self.pos) + self.roster_cache.append(resource) y += 1 if y-self.start_pos+1 == self.height: break @@ -1777,7 +1783,12 @@ class RosterWin(Win): self.finish_line() def get_selected_row(self): - return self.selected_row + if self.pos >= len(self.roster_cache): + return self.selected_row + if len(self.roster_cache) > 0: + self.selected_row = self.roster_cache[self.pos] + return self.roster_cache[self.pos] + return None class ContactInfoWin(Win): def __init__(self): |