summaryrefslogtreecommitdiff
path: root/doc/en
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-04-27 00:14:36 +0200
committerSébastien Helleu <flashcode@flashtux.org>2020-04-27 22:15:42 +0200
commitd3020976d59e5e329c851f104c633427eafe2cf3 (patch)
tree929a758b54fb388ea82b9bc5414dd78523789716 /doc/en
parent0f1cee08bf12aab377417d6d7077a4f5abdd08a3 (diff)
downloadweechat-d3020976d59e5e329c851f104c633427eafe2cf3.zip
api: add functions completion_new, completion_search and completion_free (issue #1484)
Diffstat (limited to 'doc/en')
-rw-r--r--doc/en/autogen/plugin_api/hdata.adoc9
-rw-r--r--doc/en/weechat_plugin_api.en.adoc121
-rw-r--r--doc/en/weechat_scripting.en.adoc5
3 files changed, 133 insertions, 2 deletions
diff --git a/doc/en/autogen/plugin_api/hdata.adoc b/doc/en/autogen/plugin_api/hdata.adoc
index 12fe97861..f3b9338e5 100644
--- a/doc/en/autogen/plugin_api/hdata.adoc
+++ b/doc/en/autogen/plugin_api/hdata.adoc
@@ -643,8 +643,11 @@ _next_buffer_   (pointer, hdata: "buffer_visited") +
| weechat
| [[hdata_completion]]<<hdata_completion,completion>>
| structure with completion
-| -
-| _buffer_   (pointer, hdata: "buffer") +
+| _weechat_completions_ +
+_last_weechat_completion_ +
+
+| _plugin_   (pointer, hdata: "plugin") +
+_buffer_   (pointer, hdata: "buffer") +
_context_   (integer) +
_base_command_   (string) +
_base_command_arg_index_   (integer) +
@@ -663,6 +666,8 @@ _position_replace_   (integer) +
_diff_size_   (integer) +
_diff_length_   (integer) +
_partial_list_   (pointer) +
+_prev_completion_   (pointer, hdata: "completion") +
+_next_completion_   (pointer, hdata: "completion") +
| weechat
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index 4f2703a66..17c73d182 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -14938,6 +14938,127 @@ weechat.command_options(buffer, command, options)
rc = weechat.command("", "/some_command arguments", {"commands": "*,!exec"})
----
+[[completion]]
+=== Completion
+
+Functions to complete a command line.
+
+==== completion_new
+
+_WeeChat ≥ 2.9._
+
+Create a new completion.
+
+Prototype:
+
+[source,C]
+----
+struct t_gui_completion *weechat_completion_new (struct t_gui_buffer *buffer);
+----
+
+Arguments:
+
+* _buffer_: buffer pointer
+
+Return value:
+
+* pointer to new completion
+
+C example:
+
+[source,C]
+----
+struct t_gui_completion *completion = weechat_completion_new (weechat_buffer_search_main ());
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+completion = weechat.completion_new(buffer)
+
+# example
+completion = weechat.completion_new(weechat.buffer_search_main())
+----
+
+==== completion_search
+
+_WeeChat ≥ 2.9._
+
+Search possible words at a given position of a string, in the completion
+context.
+
+Prototype:
+
+[source,C]
+----
+void weechat_completion_search (struct t_gui_completion *completion, const char *data,
+ int position, int direction);
+----
+
+Arguments:
+
+* _completion_: completion pointer
+* _data_: the string to complete
+* _position_: index of the char in string to complete (starts to 0)
+* _direction_: 1 for next completion, -1 for previous completion
+
+C example:
+
+[source,C]
+----
+struct t_gui_completion *completion = weechat_completion_new (weechat_buffer_search_main ());
+weechat_completion_search (completion, "/help filt", 10, 1);
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+weechat.completion_search(completion, data, position, direction)
+
+# example
+completion = weechat.completion_new(weechat.buffer_search_main())
+weechat.completion_search(completion, "/help filt", 10, 1);
+----
+
+==== completion_free
+
+_WeeChat ≥ 2.9._
+
+Free a completion.
+
+Prototype:
+
+[source,C]
+----
+void weechat_completion_free (struct t_gui_completion *completion);
+----
+
+Arguments:
+
+* _completion_: completion pointer
+
+C example:
+
+[source,C]
+----
+weechat_completion_free (completion);
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+weechat.completion_free(completion)
+
+# example
+weechat.completion_free(completion)
+----
+
[[network]]
=== Network
diff --git a/doc/en/weechat_scripting.en.adoc b/doc/en/weechat_scripting.en.adoc
index 35469e21f..23170fbdb 100644
--- a/doc/en/weechat_scripting.en.adoc
+++ b/doc/en/weechat_scripting.en.adoc
@@ -697,6 +697,11 @@ List of functions in script API:
command +
command_options
+| completion |
+ completion_new +
+ completion_search +
+ completion_free
+
| infos |
info_get +
info_get_hashtable