summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-02-16 00:04:59 +0100
committermathieui <mathieui@mathieui.net>2012-02-16 00:04:59 +0100
commit8478641ad0bdeebea7d79422e3174243b4508a91 (patch)
treeca482bd4c30c0a5a80832f00d4b772367bfb8f17 /src
parentc7da566f0ae6fa412341f48f27122ed7f968ae9d (diff)
downloadpoezio-8478641ad0bdeebea7d79422e3174243b4508a91.tar.gz
poezio-8478641ad0bdeebea7d79422e3174243b4508a91.tar.bz2
poezio-8478641ad0bdeebea7d79422e3174243b4508a91.tar.xz
poezio-8478641ad0bdeebea7d79422e3174243b4508a91.zip
Add shortcuts to browse the history one line at a time
(C-b / C-f)
Diffstat (limited to 'src')
-rw-r--r--src/core.py10
-rw-r--r--src/tabs.py46
2 files changed, 36 insertions, 20 deletions
diff --git a/src/core.py b/src/core.py
index 0b5bb37b..91f69813 100644
--- a/src/core.py
+++ b/src/core.py
@@ -156,6 +156,8 @@ class Core(object):
self.key_func = {
"KEY_PPAGE": self.scroll_page_up,
"KEY_NPAGE": self.scroll_page_down,
+ "^B": self.scroll_line_up,
+ "^F": self.scroll_line_down,
"KEY_F(5)": self.rotate_rooms_left,
"^P": self.rotate_rooms_left,
'kLFT3': self.rotate_rooms_left,
@@ -1130,6 +1132,14 @@ class Core(object):
self.current_tab().on_scroll_up()
self.refresh_window()
+ def scroll_line_up(self, args=None):
+ self.current_tab().on_line_up()
+ self.refresh_window()
+
+ def scroll_line_down(self, args=None):
+ self.current_tab().on_line_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 492a4412..f9032b6e 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -302,13 +302,25 @@ class Tab(object):
def on_scroll_down(self):
"""
- Defines what happens when we scrol down
+ Defines what happens when we scroll down
"""
pass
def on_scroll_up(self):
"""
- Defines what happens when we scrol down
+ Defines what happens when we scroll up
+ """
+ pass
+
+ def on_line_up(self):
+ """
+ Defines what happens when we scroll one line up
+ """
+ pass
+
+ def on_line_down(self):
+ """
+ Defines what happens when we scroll one line up
"""
pass
@@ -505,6 +517,18 @@ class ChatTab(Tab):
def command_say(self, line):
raise NotImplementedError
+ def on_line_up(self):
+ self.text_win.scroll_up(1)
+
+ def on_line_down(self):
+ self.text_win.scroll_down(1)
+
+ def on_scroll_up(self):
+ 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)
+
class MucTab(ChatTab):
"""
@@ -1055,12 +1079,6 @@ class MucTab(ChatTab):
if self.joined and config.get_by_tabname('send_chat_states', 'true', self.general_jid, True) == 'true' and not self.input.get_text():
self.send_chat_state('active')
- def on_scroll_up(self):
- 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)
-
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height-3:
return
@@ -1555,12 +1573,6 @@ class PrivateTab(ChatTab):
if tab and tab.joined and config.get_by_tabname('send_chat_states', 'true', self.general_jid, True) == 'true' and not self.input.get_text():
self.send_chat_state('active')
- def on_scroll_up(self):
- 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)
-
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height-3:
return
@@ -2340,12 +2352,6 @@ class ConversationTab(ChatTab):
if resource:
self.send_chat_state('active')
- def on_scroll_up(self):
- 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)
-
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height-3:
return