Add a shortcut to go to the first unread message (separator) with M-p

This commit is contained in:
mathieui 2012-05-17 17:15:15 +02:00
parent 0f8a5abdc0
commit 3411d8ca83
3 changed files with 10 additions and 3 deletions

View file

@ -95,6 +95,7 @@ height of the conversation window - 1.
*Alt-v*:: Move the separator at the bottom of the tab.
*Alt-h*:: Scroll to the separator, if there is one.
MultiUserChat tab input keys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -394,6 +394,7 @@ class ChatTab(Tab):
# since the last input
self.remote_supports_attention = False
self.key_func['M-v'] = self.move_separator
self.key_func['M-h'] = self.scroll_separator
self.key_func['M-/'] = self.last_words_completion
self.key_func['^M'] = self.on_enter
self.commands['say'] = (self.command_say,
@ -566,6 +567,11 @@ class ChatTab(Tab):
def on_half_scroll_down(self):
self.text_win.scroll_down((self.text_win.height-1) // 2)
def scroll_separator(self):
self.text_win.scroll_to_separator()
self.refresh()
self.core.doupdate()
class MucTab(ChatTab):
"""

View file

@ -731,11 +731,11 @@ class TextWin(Win):
present, scroll at the top of the window
"""
if None in self.built_lines:
self.pos = self.built_lines.index(None)
self.pos = len(self.built_lines) - self.built_lines.index(None) - self.height + 1
if self.pos < 0:
self.pos = 0
# Chose a proper position (not too high)
self.scroll_up(0)
else: # Go at the top of the win
self.pos = len(self.built_lines) - self.height
def remove_line_separator(self):
"""