summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-02-16 00:24:18 +0100
committermathieui <mathieui@mathieui.net>2012-02-16 00:24:18 +0100
commit55788f6127c25a549aa93efd5ed147695f875890 (patch)
tree4bcededc7a134d256a7122d1d4e33d6a21616480
parent8478641ad0bdeebea7d79422e3174243b4508a91 (diff)
downloadpoezio-55788f6127c25a549aa93efd5ed147695f875890.tar.gz
poezio-55788f6127c25a549aa93efd5ed147695f875890.tar.bz2
poezio-55788f6127c25a549aa93efd5ed147695f875890.tar.xz
poezio-55788f6127c25a549aa93efd5ed147695f875890.zip
Add half-page scrolling (C-u / C-d)
-rw-r--r--doc/en/keys.txt4
-rw-r--r--src/core.py10
-rw-r--r--src/tabs.py18
3 files changed, 32 insertions, 0 deletions
diff --git a/doc/en/keys.txt b/doc/en/keys.txt
index 616468f5..64f5dbbd 100644
--- a/doc/en/keys.txt
+++ b/doc/en/keys.txt
@@ -86,6 +86,10 @@ height of the conversation window - 1.
*Ctrl-f*:: Go one line down in the buffer.
+*Ctrl-u*:: Go half a screen up in the buffer.
+
+*Ctrl-d*:: Go half a screen down in the buffer.
+
*Alt-/*:: Complete what you’re typing using the "recent" words from the
current conversation, if any.
diff --git a/src/core.py b/src/core.py
index 91f69813..f9ae4198 100644
--- a/src/core.py
+++ b/src/core.py
@@ -158,6 +158,8 @@ class Core(object):
"KEY_NPAGE": self.scroll_page_down,
"^B": self.scroll_line_up,
"^F": self.scroll_line_down,
+ "^D": self.scroll_half_down,
+ "^U": self.scroll_half_up,
"KEY_F(5)": self.rotate_rooms_left,
"^P": self.rotate_rooms_left,
'kLFT3': self.rotate_rooms_left,
@@ -1140,6 +1142,14 @@ class Core(object):
self.current_tab().on_line_down()
self.refresh_window()
+ def scroll_half_up(self, args=None):
+ self.current_tab().on_half_scroll_up()
+ self.refresh_window()
+
+ def scroll_half_down(self, args=None):
+ self.current_tab().on_half_scroll_down()
+ self.refresh_window()
+
def get_error_message_from_error_stanza(self, stanza):
"""
Takes a stanza of the form <message type='error'><error/></message>
diff --git a/src/tabs.py b/src/tabs.py
index f9032b6e..55e3154c 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -324,6 +324,18 @@ class Tab(object):
"""
pass
+ def on_half_scroll_down(self):
+ """
+ Defines what happens when we scroll half a screen down
+ """
+ pass
+
+ def on_half_scroll_up(self):
+ """
+ Defines what happens when we scroll half a screen up
+ """
+ pass
+
def on_info_win_size_changed(self):
"""
Called when the window with the informations is resized
@@ -529,6 +541,12 @@ class ChatTab(Tab):
def on_scroll_down(self):
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)
+
+ def on_half_scroll_down(self):
+ self.text_win.scroll_down((self.text_win.height-1) // 2)
+
class MucTab(ChatTab):
"""