aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/buffer.c1
-rw-r--r--src/nvim/api/vim.c6
-rw-r--r--src/nvim/eval/funcs.c5
3 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 7cd9686544..02b97b0ae1 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -515,6 +515,7 @@ end:
void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, Integer start_col,
Integer end_row, Integer end_col, ArrayOf(String) replacement, Error *err)
FUNC_API_SINCE(7)
+ FUNC_API_TEXTLOCK_ALLOW_CMDWIN
{
MAXSIZE_TEMP_ARRAY(scratch, 1);
if (replacement.size == 0) {
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index eacc833c58..8c40e5ccd7 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -951,12 +951,18 @@ fail:
/// @return Channel id, or 0 on error
Integer nvim_open_term(Buffer buffer, DictionaryOf(LuaRef) opts, Error *err)
FUNC_API_SINCE(7)
+ FUNC_API_TEXTLOCK_ALLOW_CMDWIN
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return 0;
}
+ if (cmdwin_type != 0 && buf == curbuf) {
+ api_set_error(err, kErrorTypeException, "%s", _(e_cmdwin));
+ return 0;
+ }
+
LuaRef cb = LUA_NOREF;
for (size_t i = 0; i < opts.size; i++) {
String k = opts.items[i].key;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f348a61075..7c3c5cc274 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -8385,7 +8385,10 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (check_secure()) {
return;
}
-
+ if (text_locked()) {
+ text_locked_msg();
+ return;
+ }
if (curbuf->b_changed) {
emsg(_("Can only call this function in an unmodified buffer"));
return;