degesch: add goto activity and highlight

This commit is contained in:
Přemysl Eric Janouch 2016-03-08 22:27:59 +01:00
parent 09c7d9a65d
commit dc248b8840
2 changed files with 46 additions and 0 deletions

3
NEWS
View File

@ -18,6 +18,9 @@
* degesch: added logging of messages sent from /quote and plugins * 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 * kike: add support for IRCv3.2 server-time
* ZyklonB: plugins now run in a dedicated data directory * ZyklonB: plugins now run in a dedicated data directory

View File

@ -11758,6 +11758,45 @@ on_switch_buffer (int count, int key, void *user_data)
return true; return true;
} }
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 static bool
on_redraw_screen (int count, int key, void *user_data) on_redraw_screen (int count, int key, void *user_data)
{ {
@ -11799,6 +11838,8 @@ bind_common_keys (struct app_context *ctx)
XX ("next-buffer", "Next buffer", on_next_buffer) XX ("next-buffer", "Next buffer", on_next_buffer)
XX ("goto-buffer", "Go to buffer", on_goto_buffer) XX ("goto-buffer", "Go to buffer", on_goto_buffer)
XX ("switch-buffer", "Switch buffer", on_switch_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-backlog", "Show backlog", on_display_backlog)
XX ("display-full-log", "Show full log", on_display_full_log) XX ("display-full-log", "Show full log", on_display_full_log)
XX ("edit-input", "Edit input", on_edit_input) 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, '0' + i, "goto-buffer");
CALL_ (self, bind_meta, '\t', "switch-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, 'm', "insert-attribute");
CALL_ (self, bind_meta, 'h', "display-full-log"); CALL_ (self, bind_meta, 'h', "display-full-log");
CALL_ (self, bind_meta, 'e', "edit-input"); CALL_ (self, bind_meta, 'e', "edit-input");