1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

api: add function completion_set

This commit is contained in:
Sébastien Helleu
2025-02-15 23:22:44 +01:00
parent 1b54cd24ed
commit c7d21a3ea6
25 changed files with 577 additions and 16 deletions
+19
View File
@@ -4718,6 +4718,24 @@ API_FUNC(completion_get_string)
API_RETURN_STRING(result);
}
API_FUNC(completion_set)
{
char *completion, *property, *value;
API_INIT_FUNC(1, "completion_set", API_RETURN_ERROR);
completion = NULL;
property = NULL;
value = NULL;
if (!PyArg_ParseTuple (args, "sss", &completion, &property, &value))
API_WRONG_ARGS(API_RETURN_ERROR);
weechat_completion_set (API_STR2PTR(completion),
property,
value);
API_RETURN_OK;
}
API_FUNC(completion_list_add)
{
char *completion, *word, *where;
@@ -5798,6 +5816,7 @@ PyMethodDef weechat_python_funcs[] =
API_DEF_FUNC(completion_new),
API_DEF_FUNC(completion_search),
API_DEF_FUNC(completion_get_string),
API_DEF_FUNC(completion_set),
API_DEF_FUNC(completion_list_add),
API_DEF_FUNC(completion_free),
API_DEF_FUNC(info_get),
+14
View File
@@ -2339,6 +2339,20 @@ def completion_get_string(completion: str, property: str) -> str:
...
def completion_set(completion: str, property: str, value: str) -> int:
"""`completion_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_set>`_
::
# example
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# do not add space after completion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
"""
...
def completion_list_add(completion: str, word: str, nick_completion: int, where: str) -> int:
"""`completion_list_add in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_list_add>`_
::