summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-08-24 19:20:05 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-08-24 19:20:05 +0200
commit2092715ac73588725809a5a5659cdcd52a4ecb81 (patch)
tree88bcf82380e673b8888d4c6c31739ccd8b0ad71e
parent272bcf3c97019411c1d9c4787663de1bb689a768 (diff)
downloadweechat-2092715ac73588725809a5a5659cdcd52a4ecb81.zip
core: add buffer local keys in completion "buffer_properties_setauto"
-rw-r--r--src/core/wee-completion.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c
index 9c4674af6..f82271d82 100644
--- a/src/core/wee-completion.c
+++ b/src/core/wee-completion.c
@@ -513,8 +513,8 @@ completion_list_map_buffer_local_variable_setauto_cb (void *data,
}
/*
- * Adds buffer properties and local variables (that can be set) to completion
- * list.
+ * Adds buffer properties (that can be set), local variables and key bindings
+ * to completion list.
*/
int
@@ -523,6 +523,8 @@ completion_list_add_buffer_properties_setauto_cb (const void *pointer, void *dat
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
+ struct t_gui_key *ptr_key;
+ char str_key[1024];
int i;
/* make C compiler happy */
@@ -531,6 +533,7 @@ completion_list_add_buffer_properties_setauto_cb (const void *pointer, void *dat
(void) completion_item;
(void) buffer;
+ /* add buffer properties */
for (i = 0; gui_buffer_properties_set[i]; i++)
{
gui_completion_list_add (completion,
@@ -538,10 +541,21 @@ completion_list_add_buffer_properties_setauto_cb (const void *pointer, void *dat
0, WEECHAT_LIST_POS_SORT);
}
+ /* add buffer local variables */
hashtable_map (completion->buffer->local_variables,
&completion_list_map_buffer_local_variable_setauto_cb,
completion);
+ /* add buffer keys */
+ for (ptr_key = completion->buffer->keys; ptr_key;
+ ptr_key = ptr_key->next_key)
+ {
+ snprintf (str_key, sizeof (str_key), "key_bind_%s", ptr_key->key);
+ gui_completion_list_add (completion, str_key, 0, WEECHAT_LIST_POS_SORT);
+ snprintf (str_key, sizeof (str_key), "key_unbind_%s", ptr_key->key);
+ gui_completion_list_add (completion, str_key, 0, WEECHAT_LIST_POS_SORT);
+ }
+
return WEECHAT_RC_OK;
}