aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-07 04:47:18 +0800
committerGitHub <noreply@github.com>2022-07-07 04:47:18 +0800
commit664efa497e4e3d79d2e4ab486acbf1471b2389b0 (patch)
tree389a04a3846cf3d5df7464b03294be48302ee09e /src/nvim/edit.c
parent1e03255646be3a31d44db4118ee2194d45f6bf1c (diff)
downloadrneovim-664efa497e4e3d79d2e4ab486acbf1471b2389b0.tar.gz
rneovim-664efa497e4e3d79d2e4ab486acbf1471b2389b0.tar.bz2
rneovim-664efa497e4e3d79d2e4ab486acbf1471b2389b0.zip
vim-patch:8.2.0614: get ml_get error when deleting a line in 'completefunc' (#19244)
Problem: Get ml_get error when deleting a line in 'completefunc'. (Yegappan Lakshmanan) Solution: Lock the text while evaluating 'completefunc'. https://github.com/vim/vim/commit/ff06f283e3e4b3ec43012dd3b83f8454c98f6639 Fix a mistake in the porting of patch 8.1.0098. Cherry-pick Test_run_excmd_with_text_locked() from patch 8.2.0270. Cherry-pick test_gf.vim changes from patch 8.2.0369. Cherry-pick message change from later patches.
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index de6f2c32de..2abe9068eb 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1409,14 +1409,9 @@ bool edit(int cmdchar, bool startln, long count)
// Don't allow changes in the buffer while editing the cmdline. The
// caller of getcmdline() may get confused.
- if (textlock != 0) {
- emsg(_(e_secure));
- return false;
- }
-
// Don't allow recursive insert mode when busy with completion.
- if (compl_started || compl_busy || pum_visible()) {
- emsg(_(e_secure));
+ if (textlock != 0 || compl_started || compl_busy || pum_visible()) {
+ emsg(_(e_textlock));
return false;
}
@@ -3966,6 +3961,8 @@ static void expand_by_function(int type, char_u *base)
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
+ // Lock the text to avoid weird things from happening.
+ textlock++;
// Call a function, which returns a list or dict.
if (call_vim_function((char *)funcname, 2, args, &rettv) == OK) {
@@ -3984,6 +3981,7 @@ static void expand_by_function(int type, char_u *base)
break;
}
}
+ textlock--;
if (curwin_save != curwin || curbuf_save != curbuf) {
emsg(_(e_complwin));