summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-08-24 19:03:44 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-08-24 19:03:44 +0200
commit3a59f2f65e1fc4d604e93378ee63a01208296dc6 (patch)
treef18ae13cd1324a6b0d565a101f670b7e50d14f3d /src/plugins/irc
parent817d1eaf8e0be700bf9b61dcbaf9db7ab507d3af (diff)
downloadweechat-3a59f2f65e1fc4d604e93378ee63a01208296dc6.zip
irc: add local key bindings during the /list buffer creation
This allows the user to bind or unbind keys by setting options "weechat.buffer.irc.list_xxx.key_bind_*" and "weechat.buffer.irc.list_xxx.key_unbind_*".
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-list.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/src/plugins/irc/irc-list.c b/src/plugins/irc/irc-list.c
index c8a6c11b4..09750829d 100644
--- a/src/plugins/irc/irc-list.c
+++ b/src/plugins/irc/irc-list.c
@@ -909,33 +909,6 @@ irc_list_buffer_input_data (struct t_gui_buffer *buffer, const char *input_data)
}
/*
- * Sets keys on list buffer.
- */
-
-void
-irc_list_buffer_set_keys (struct t_gui_buffer *buffer)
-{
- char *keys[][2] = {
- { "up", "/list -up" },
- { "down", "/list -down" },
- { "meta-home", "/list -go 0" },
- { "meta-end", "/list -go end" },
- { "f11", "/list -left" },
- { "f12", "/list -right" },
- { "ctrl-j", "/list -join" },
- { NULL, NULL },
- };
- char str_key[64];
- int i;
-
- for (i = 0; keys[i][0]; i++)
- {
- snprintf (str_key, sizeof (str_key), "key_bind_%s", keys[i][0]);
- weechat_buffer_set (buffer, str_key, keys[i][1]);
- }
-}
-
-/*
* Creates buffer with list of channels for a server.
*
* Returns pointer to newly created buffer, NULL if error.
@@ -963,6 +936,14 @@ irc_list_create_buffer (struct t_irc_server *server)
weechat_hashtable_set (buffer_props, "localvar_set_no_log", "1");
/* disable all highlights on this buffer */
weechat_hashtable_set (buffer_props, "highlight_words", "-");
+ /* set keys on buffer */
+ weechat_hashtable_set (buffer_props, "key_bind_up", "/list -up");
+ weechat_hashtable_set (buffer_props, "key_bind_down", "/list -down");
+ weechat_hashtable_set (buffer_props, "key_bind_meta-home", "/list -go 0");
+ weechat_hashtable_set (buffer_props, "key_bind_meta-end", "/list -go end");
+ weechat_hashtable_set (buffer_props, "key_bind_f11", "/list -left");
+ weechat_hashtable_set (buffer_props, "key_bind_f12", "/list -right");
+ weechat_hashtable_set (buffer_props, "key_bind_ctrl-j", "/list -join");
}
current_buffer_number = weechat_buffer_get_integer (
@@ -979,7 +960,6 @@ irc_list_create_buffer (struct t_irc_server *server)
if (buffer_props)
weechat_hashtable_free (buffer_props);
- irc_list_buffer_set_keys (buffer);
irc_list_buffer_set_localvar_filter (buffer, server);
if (weechat_buffer_get_integer (buffer, "layout_number") < 1)