diff options
author | mathieui <mathieui@mathieui.net> | 2012-05-17 01:00:35 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-05-17 01:00:35 +0200 |
commit | 0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9 (patch) | |
tree | 7ed6d0e0b6b80544ff40eeb57daad0d7d8c0eac1 /src/tabs.py | |
parent | da30c8c79f5950ef85296ba8f749b929b1bbbd57 (diff) | |
download | poezio-0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9.tar.gz poezio-0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9.tar.bz2 poezio-0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9.tar.xz poezio-0f7bda20b8b89bf334d67da45f4fc3e4dc8117f9.zip |
Add a way to review room highlights - Fixes #1673
This new features is available with M-p and M-n (previous/next).
It saves the last highlight viewed, meaning that if you scroll in the
buffer, M-n or M-p will take you to the next or previous hl compared to
the one before you started scrolling.
For convenience, going to the previous highlight of the first highlight
will take you to the bottom of the buffer, and going to the next
highlight of the last highlight will do *the same*.
If there are several highlights in one message, only the first line will
be considered a highlight.
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tabs.py b/src/tabs.py index 39b81df7..f97c7f03 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -600,6 +600,8 @@ class MucTab(ChatTab): self.key_func['^I'] = self.completion self.key_func['M-u'] = self.scroll_user_list_down self.key_func['M-y'] = self.scroll_user_list_up + self.key_func['M-n'] = self.go_to_next_hl + self.key_func['M-p'] = self.go_to_prev_hl # commands self.commands['ignore'] = (self.command_ignore, _("Usage: /ignore <nickname> \nIgnore: Ignore a specified nickname."), self.completion_ignore) self.commands['unignore'] = (self.command_unignore, _("Usage: /unignore <nickname>\nUnignore: Remove the specified nickname from the ignore list."), self.completion_unignore) @@ -630,6 +632,22 @@ class MucTab(ChatTab): def general_jid(self): return self.get_name() + def go_to_next_hl(self): + """ + Go to the next HL in the room, or the last + """ + self.text_win.next_highlight() + self.refresh() + self.core.doupdate() + + def go_to_prev_hl(self): + """ + Go to the previous HL in the room, or the first + """ + self.text_win.previous_highlight() + self.refresh() + self.core.doupdate() + def completion_version(self, the_input): """Completion for /version""" compare_users = lambda x: x.last_talked @@ -1502,7 +1520,7 @@ class MucTab(ChatTab): if highlight: nick_color = highlight time = time or datetime.now() - self._text_buffer.add_message(txt, time, nickname, nick_color, history, user) + self._text_buffer.add_message(txt, time, nickname, nick_color, history, user, highlight=highlight) return highlight class PrivateTab(ChatTab): |