From 09a124c22697686c8420c5201d25c39d3bd72c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 20 Jan 2019 01:09:26 +0100 Subject: buflist: add alternate key codes for F1/F2 and alt-F1/alt-F2 (compatibility with terminals) --- src/plugins/buflist/buflist.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/plugins/buflist/buflist.c') diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c index e0b43ef8e..25bf0cfb5 100644 --- a/src/plugins/buflist/buflist.c +++ b/src/plugins/buflist/buflist.c @@ -412,8 +412,19 @@ int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_hashtable *keys; - char str_key[256]; int i; + char str_key[256]; + char *default_keys[][2] = { + { /* */ "meta-OP", "/bar scroll buflist * -100%" }, + { /* */ "meta2-11~", "/bar scroll buflist * -100%" }, + { /* */ "meta-OQ", "/bar scroll buflist * +100%" }, + { /* */ "meta2-12~", "/bar scroll buflist * +100%" }, + { /* m- */ "meta-meta-OP", "/bar scroll buflist * b" }, + { /* m- */ "meta-meta2-11~", "/bar scroll buflist * b" }, + { /* m- */ "meta-meta-OQ", "/bar scroll buflist * e" }, + { /* m- */ "meta-meta2-12~", "/bar scroll buflist * e" }, + { NULL, NULL }, + }; /* make C compiler happy */ (void) argc; @@ -453,14 +464,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) if (keys) { /* default keys */ - weechat_hashtable_set (keys, - "meta-OP", "/bar scroll buflist * -100%"); - weechat_hashtable_set (keys, - "meta-OQ", "/bar scroll buflist * +100%"); - weechat_hashtable_set (keys, - "meta-meta-OP", "/bar scroll buflist * b"); - weechat_hashtable_set (keys, - "meta-meta-OQ", "/bar scroll buflist * e"); + for (i = 0; default_keys[i][0]; i++) + { + weechat_hashtable_set (keys, + default_keys[i][0], default_keys[i][1]); + } weechat_key_bind ("default", keys); /* default mouse actions */ -- cgit v1.2.3