diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-01-20 01:09:26 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-01-20 01:09:26 +0100 |
commit | 09a124c22697686c8420c5201d25c39d3bd72c13 (patch) | |
tree | 6b2355fedc304e7fc6874ba212b8ab6e68b426fc /src/plugins/buflist/buflist.c | |
parent | 7d442f8492e52babf74d8c9c5461a58257aee10e (diff) | |
download | weechat-09a124c22697686c8420c5201d25c39d3bd72c13.zip |
buflist: add alternate key codes for F1/F2 and alt-F1/alt-F2 (compatibility with terminals)
Diffstat (limited to 'src/plugins/buflist/buflist.c')
-rw-r--r-- | src/plugins/buflist/buflist.c | 26 |
1 files changed, 17 insertions, 9 deletions
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] = { + { /* <f1> */ "meta-OP", "/bar scroll buflist * -100%" }, + { /* <f1> */ "meta2-11~", "/bar scroll buflist * -100%" }, + { /* <f2> */ "meta-OQ", "/bar scroll buflist * +100%" }, + { /* <f2> */ "meta2-12~", "/bar scroll buflist * +100%" }, + { /* m-<f1> */ "meta-meta-OP", "/bar scroll buflist * b" }, + { /* m-<f1> */ "meta-meta2-11~", "/bar scroll buflist * b" }, + { /* m-<f2> */ "meta-meta-OQ", "/bar scroll buflist * e" }, + { /* m-<f2> */ "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 */ |