summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/script/script-buffer.c17
-rw-r--r--src/plugins/script/script-buffer.h2
-rw-r--r--src/plugins/script/script-config.c2
3 files changed, 15 insertions, 6 deletions
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);
}
/*