diff options
author | mathieui <mathieui@mathieui.net> | 2012-07-26 12:40:08 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-07-26 12:40:08 +0200 |
commit | d8623d1c509e8f90234d239e61bb0e8bd93851e6 (patch) | |
tree | 5ff12918b3bc26808f94d3ae37f0928a8d0297e1 /src/tabs.py | |
parent | c4fcf3c71af98f74497cb770c468bd860d010804 (diff) | |
download | poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.gz poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.bz2 poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.tar.xz poezio-d8623d1c509e8f90234d239e61bb0e8bd93851e6.zip |
Change how scrolling is done
- All functions involved return a boolean, and the core function use
that value to determine if a refresh is needed or not. (avoids useless
refreshs)
- Scrolling with PGUP/DOWN on the roster now only does _one_ action, an
not a range corresponding to the screen size (should be way faster)
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/tabs.py b/src/tabs.py index 7eed1790..74475779 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -543,22 +543,22 @@ class ChatTab(Tab): raise NotImplementedError def on_line_up(self): - self.text_win.scroll_up(1) + return self.text_win.scroll_up(1) def on_line_down(self): - self.text_win.scroll_down(1) + return self.text_win.scroll_down(1) def on_scroll_up(self): - self.text_win.scroll_up(self.text_win.height-1) + return self.text_win.scroll_up(self.text_win.height-1) def on_scroll_down(self): - self.text_win.scroll_down(self.text_win.height-1) + return self.text_win.scroll_down(self.text_win.height-1) def on_half_scroll_up(self): - self.text_win.scroll_up((self.text_win.height-1) // 2) + return self.text_win.scroll_up((self.text_win.height-1) // 2) def on_half_scroll_down(self): - self.text_win.scroll_down((self.text_win.height-1) // 2) + return self.text_win.scroll_down((self.text_win.height-1) // 2) def scroll_separator(self): self.text_win.scroll_to_separator() @@ -2359,14 +2359,10 @@ class RosterInfoTab(Tab): self.core.doupdate() def on_scroll_down(self): - for i in range(self.height-1): - self.roster_win.move_cursor_down() - return True + return self.roster_win.move_cursor_down(self.height // 2) def on_scroll_up(self): - for i in range(self.height-1): - self.roster_win.move_cursor_up() - return True + return self.roster_win.move_cursor_up(self.height // 2) def on_space(self): selected_row = self.roster_win.get_selected_row() @@ -2858,10 +2854,10 @@ class MucListTab(Tab): curses.curs_set(0) def on_scroll_up(self): - self.listview.scroll_up() + return self.listview.scroll_up() def on_scroll_down(self): - self.listview.scroll_down() + return self.listview.scroll_down() class XMLTab(Tab): @@ -2943,10 +2939,10 @@ class XMLTab(Tab): return True def on_scroll_up(self): - self.text_win.scroll_up(self.text_win.height-1) + return self.text_win.scroll_up(self.text_win.height-1) def on_scroll_down(self): - self.text_win.scroll_down(self.text_win.height-1) + return self.text_win.scroll_down(self.text_win.height-1) def command_clear(self, args): """ |