diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/plugins/script/script-buffer.c | 17 | ||||
-rw-r--r-- | src/plugins/script/script-buffer.h | 2 | ||||
-rw-r--r-- | src/plugins/script/script-config.c | 2 |
4 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6725ec3da..efc653dec 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -49,6 +49,7 @@ Bug fixes:: * irc: add missing "account-tag" in list of supported capabilities * irc: add channel in "autojoin" server option only when the channel is actually joined (issue #1990) * relay: synchronize nick modes with IRC client upon connection (issue #1984) + * script: add local key bindings during the buffer creation * script: add parameters up/down/go in `/help script` and command completion * script: fix cursor position after `/script list -i` or `/script list -il` * script: fix buffer used by command `/script list -i|-il|-o|-ol` diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c index f05ee1e3a..08f45a02f 100644 --- a/src/plugins/script/script-buffer.c +++ b/src/plugins/script/script-buffer.c @@ -1085,10 +1085,13 @@ script_buffer_set_callbacks () /* * Sets keys on script buffer. + * + * If hashtable is not NULL, it is used to set keys, otherwise keys are directly + * set in the script buffer. */ void -script_buffer_set_keys () +script_buffer_set_keys (struct t_hashtable *hashtable) { char *keys[][2] = { { "meta-A", "toggleautoload" }, @@ -1113,12 +1116,18 @@ script_buffer_set_keys () { snprintf (str_key, sizeof (str_key), "key_bind_%s", keys[i][0]); snprintf (str_command, sizeof (str_command), "/script %s", keys[i][1]); - weechat_buffer_set (script_buffer, str_key, str_command); + if (hashtable) + weechat_hashtable_set (hashtable, str_key, str_command); + else + weechat_buffer_set (script_buffer, str_key, str_command); } else { snprintf (str_key, sizeof (str_key), "key_unbind_%s", keys[i][0]); - weechat_buffer_set (script_buffer, str_key, ""); + if (hashtable) + weechat_hashtable_set (hashtable, str_key, ""); + else + weechat_buffer_set (script_buffer, str_key, ""); } } } @@ -1159,6 +1168,7 @@ script_buffer_open () weechat_hashtable_set (buffer_props, "type", "free"); weechat_hashtable_set (buffer_props, "title", _("Scripts")); weechat_hashtable_set (buffer_props, "localvar_set_type", "script"); + script_buffer_set_keys (buffer_props); } script_buffer = weechat_buffer_new_props ( @@ -1173,7 +1183,6 @@ script_buffer_open () if (!script_buffer) return; - script_buffer_set_keys (); script_buffer_set_localvar_filter (); script_buffer_selected_line = 0; diff --git a/src/plugins/script/script-buffer.h b/src/plugins/script/script-buffer.h index d1e6dd1a9..1f22cf949 100644 --- a/src/plugins/script/script-buffer.h +++ b/src/plugins/script/script-buffer.h @@ -46,7 +46,7 @@ extern int script_buffer_input_cb (const void *pointer, void *data, extern int script_buffer_close_cb (const void *pointer, void *data, struct t_gui_buffer *buffer); extern void script_buffer_set_callbacks (); -extern void script_buffer_set_keys (); +extern void script_buffer_set_keys (struct t_hashtable *hashtable); extern void script_buffer_set_localvar_filter (); extern void script_buffer_open (); diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c index 647d97176..28b6c81a5 100644 --- a/src/plugins/script/script-config.c +++ b/src/plugins/script/script-config.c @@ -279,7 +279,7 @@ script_config_change_use_keys_cb (const void *pointer, void *data, (void) option; if (script_buffer) - script_buffer_set_keys (); + script_buffer_set_keys (NULL); } /* |