diff options
-rw-r--r-- | runtime/doc/map.txt | 3 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 4 | ||||
-rw-r--r-- | runtime/lua/vim/shared.lua | 3 | ||||
-rw-r--r-- | src/nvim/cmdexpand.c | 4 | ||||
-rw-r--r-- | src/nvim/spell.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_spell.vim | 13 | ||||
-rw-r--r-- | test/functional/lua/vim_spec.lua | 6 |
7 files changed, 33 insertions, 5 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 60cc915a4a..c4bacfd632 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -215,6 +215,9 @@ The search string will not be echoed when using this mapping. Messages from the executed command are still given though. To shut them up too, add a ":silent" in the executed command: > :map <silent> ,h :exe ":silent normal /Header\r"<CR> +Note that the effect of a command might also be silenced, e.g., when the +mapping selects another entry for command line completion it won't be +displayed. Prompts will still be given, e.g., for inputdialog(). Using "<silent>" for an abbreviation is possible, but will cause redrawing of the command line to fail. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index d6cd370ec7..dfaff672e6 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -212,7 +212,7 @@ treesitter queries from Lua. TREESITTER QUERY PREDICATES *treesitter-predicates* Predicates are special scheme nodes that are evaluated to conditionally capture -nodes. For example, the |eq?| predicate can be used as follows: > +nodes. For example, the `eq?` predicate can be used as follows: > ((identifier) @foo (#eq? @foo "foo")) < @@ -261,7 +261,7 @@ predicates. TREESITTER QUERY DIRECTIVES *treesitter-directives* Treesitter directives store metadata for a node or match and perform side -effects. For example, the |set!| predicate sets metadata on the match or node: > +effects. For example, the `set!` directive sets metadata on the match or node: > ((identifier) @foo (#set! "type" "parameter")) < diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index f980547ae4..f4a57c13c8 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -49,6 +49,9 @@ vim.deepcopy = (function() if f then return f(orig, cache or {}) else + if type(orig) == 'userdata' and orig == vim.NIL then + return vim.NIL + end error('Cannot deepcopy object of type ' .. type(orig)) end end diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index ef742525da..e0bf562bb8 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -173,7 +173,9 @@ int nextwild(expand_T *xp, int type, int options, bool escape) return FAIL; } - if (!(ui_has(kUICmdline) || ui_has(kUIWildmenu))) { + // If cmd_silent is set then don't show the dots, because redrawcmd() below + // won't remove them. + if (!cmd_silent && !(ui_has(kUICmdline) || ui_has(kUIWildmenu))) { msg_puts("..."); // show that we are busy ui_flush(); } diff --git a/src/nvim/spell.c b/src/nvim/spell.c index b1daf4ed23..b9ea7557c4 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -110,6 +110,7 @@ #include "nvim/types.h" // for char_u #include "nvim/undo.h" // for u_save_cursor #include "nvim/vim.h" // for curwin, strlen, STRLCPY, STRNCMP +#include "nvim/window.h" // for win_valid_any_tab // Result values. Lower number is accepted over higher one. enum { @@ -1965,8 +1966,8 @@ char *did_set_spelllang(win_T *wp) } else { spell_load_lang((char_u *)lang); // SpellFileMissing autocommands may do anything, including - // destroying the buffer we are using... - if (!bufref_valid(&bufref)) { + // destroying the buffer we are using or closing the window. + if (!bufref_valid(&bufref) || !win_valid_any_tab(wp)) { ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer"); goto theend; } diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim index ea18fc5194..a919156066 100644 --- a/src/nvim/testdir/test_spell.vim +++ b/src/nvim/testdir/test_spell.vim @@ -159,6 +159,19 @@ func Test_spell_file_missing() %bwipe! endfunc +func Test_spell_file_missing_bwipe() + " this was using a window that was wiped out in a SpellFileMissing autocmd + set spelllang=xy + au SpellFileMissing * n0 + set spell + au SpellFileMissing * bw + snext somefile + + au! SpellFileMissing + bwipe! + set nospell spelllang=en +endfunc + func Test_spelldump() " In case the spell file is not found avoid getting the download dialog, we " would get stuck at the prompt. diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 6d0d87746c..21f2c19fbb 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -419,6 +419,12 @@ describe('lua stdlib', function() return getmetatable(t2) == mt ]])) + ok(exec_lua([[ + local t1 = {a = vim.NIL} + local t2 = vim.deepcopy(t1) + return t2.a == vim.NIL + ]])) + matches('Cannot deepcopy object of type thread', pcall_err(exec_lua, [[ local thread = coroutine.create(function () return 0 end) |