buflist: add alternate key codes for F1/F2 and alt-F1/alt-F2 (compatibility with terminals)

v2.8-utf8proc
Sébastien Helleu 2019-01-20 01:09:26 +01:00
parent 7d442f8492
commit 09a124c226
2 changed files with 18 additions and 9 deletions

View File

@ -31,6 +31,7 @@ New features::
Bug fixes::
* core: fix forced highlight on messages sent to other buffers (issue #1277)
* buflist: add alternate key codes for kbd:[F1]/kbd:[F2] and kbd:[Alt+F1]/kbd:[Alt+F2] (compatibility with terminals)
* buflist: fix warning displayed when script buffers.pl is loaded (issue #1274)
* irc: fix parsing of "time" message tag on FreeBSD (issue #1289)
* relay: fix memory leak in connection of client

View File

@ -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 */