patch 8.1.2080: the terminal API is limited and can't be disabled
Problem: The terminal API is limited and can't be disabled.
Solution: Add term_setapi() to set the function prefix. (Ozaki Kiichi,
closes #2907)
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index c0caa67..ab26631 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 8.1. Last change: 2019 Sep 20
+*terminal.txt* For Vim version 8.1. Last change: 2019 Sep 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -222,7 +222,7 @@
Vim width (no window left or right of
the terminal window) this value is
ignored.
- ++eof={text} when using [range]: text to send after
+ ++eof={text} When using [range]: text to send after
the last line was written. Cannot
contain white space. A CR is
appended. For MS-Windows the default
@@ -234,6 +234,10 @@
++type={pty} (MS-Windows only): Use {pty} as the
virtual console. See 'termwintype'
for the values.
+ ++api={expr} Permit the function name starting with
+ {expr} to be called as |terminal-api|
+ function. If {expr} is empty then no
+ function can be called.
If you want to use more options use the |term_start()|
function.
@@ -701,6 +705,15 @@
GetBufnr()->term_sendkeys(keys)
+term_setapi({buf}, {expr}) *term_setapi()*
+ Set the function name prefix to be used for the |terminal-api|
+ function in terminal {buf}. For example: >
+ :call term_setapi(buf, "Myapi_")
+ :call term_setapi(buf, "")
+<
+ The default is "Tapi_". When {expr} is an empty string then
+ no |terminal-api| function can be used for {buf}.
+
term_setansicolors({buf}, {colors}) *term_setansicolors()*
Set the ANSI color palette used by terminal {buf}.
{colors} must be a List of 16 valid color names or hexadecimal
@@ -843,6 +856,9 @@
color modes. See |g:terminal_ansi_colors|.
"tty_type" (MS-Windows only): Specify which pty to
use. See 'termwintype' for the values.
+ "term_api" function name prefix for the
+ |terminal-api| function. See
+ |term_setapi()|.
Can also be used as a |method|: >
GetCommand()->term_start()
@@ -902,9 +918,9 @@
Call a user defined function with {argument}.
The function is called with two arguments: the buffer number
of the terminal and {argument}, the decoded JSON argument.
- The function name must start with "Tapi_" to avoid
+ By default, the function name must start with "Tapi_" to avoid
accidentally calling a function not meant to be used for the
- terminal API.
+ terminal API. This can be changed with |term_setapi()|.
The user function should sanity check the argument.
The function can use |term_sendkeys()| to send back a reply.
Example in JSON: >