summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-03-08 22:27:59 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-03-08 22:29:40 +0100
commitdc248b8840b1d6b8fdce1f4e7dced7fa6b06ae72 (patch)
tree5fbc02d907afbea68ecd65a16bac0d97e0e04e4b
parent09c7d9a65d5459d97fac5827099aadb8bff3c69a (diff)
downloadxK-dc248b8840b1d6b8fdce1f4e7dced7fa6b06ae72.tar.gz
xK-dc248b8840b1d6b8fdce1f4e7dced7fa6b06ae72.tar.xz
xK-dc248b8840b1d6b8fdce1f4e7dced7fa6b06ae72.zip
degesch: add goto activity and highlight
-rw-r--r--NEWS3
-rw-r--r--degesch.c43
2 files changed, 46 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index aad76d2..047c527 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@
* degesch: added logging of messages sent from /quote and plugins
+ * degesch: M-! and M-@ to go to the next buffer in order with
+ a highlight or new activity respectively
+
* kike: add support for IRCv3.2 server-time
* ZyklonB: plugins now run in a dedicated data directory
diff --git a/degesch.c b/degesch.c
index c433733..29909d5 100644
--- a/degesch.c
+++ b/degesch.c
@@ -11759,6 +11759,45 @@ on_switch_buffer (int count, int key, void *user_data)
}
static bool
+on_goto_highlight (int count, int key, void *user_data)
+{
+ (void) count;
+ (void) key;
+
+ struct app_context *ctx = user_data;
+ struct buffer *new_buffer = ctx->current_buffer;
+ while (!new_buffer->highlighted)
+ {
+ if (!(new_buffer = new_buffer->next))
+ new_buffer = ctx->buffers;
+ if (new_buffer == ctx->current_buffer)
+ return false;
+ }
+ buffer_activate (ctx, new_buffer);
+ return true;
+}
+
+static bool
+on_goto_activity (int count, int key, void *user_data)
+{
+ (void) count;
+ (void) key;
+
+ struct app_context *ctx = user_data;
+ struct buffer *new_buffer = ctx->current_buffer;
+ while (new_buffer->unseen_messages_count
+ == new_buffer->unseen_unimportant_count)
+ {
+ if (!(new_buffer = new_buffer->next))
+ new_buffer = ctx->buffers;
+ if (new_buffer == ctx->current_buffer)
+ return false;
+ }
+ buffer_activate (ctx, new_buffer);
+ return true;
+}
+
+static bool
on_redraw_screen (int count, int key, void *user_data)
{
(void) count;
@@ -11799,6 +11838,8 @@ bind_common_keys (struct app_context *ctx)
XX ("next-buffer", "Next buffer", on_next_buffer)
XX ("goto-buffer", "Go to buffer", on_goto_buffer)
XX ("switch-buffer", "Switch buffer", on_switch_buffer)
+ XX ("goto-highlight", "Go to highlight", on_goto_highlight)
+ XX ("goto-activity", "Go to activity", on_goto_activity)
XX ("display-backlog", "Show backlog", on_display_backlog)
XX ("display-full-log", "Show full log", on_display_full_log)
XX ("edit-input", "Edit input", on_edit_input)
@@ -11815,6 +11856,8 @@ bind_common_keys (struct app_context *ctx)
CALL_ (self, bind_meta, '0' + i, "goto-buffer");
CALL_ (self, bind_meta, '\t', "switch-buffer");
+ CALL_ (self, bind_meta, '!', "goto-highlight");
+ CALL_ (self, bind_meta, '@', "goto-activity");
CALL_ (self, bind_meta, 'm', "insert-attribute");
CALL_ (self, bind_meta, 'h', "display-full-log");
CALL_ (self, bind_meta, 'e', "edit-input");