aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-04 09:21:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-04 09:37:45 +0800
commit1ff86aa634cc5b12e3f804f6594c36799acbf296 (patch)
treea94d5169fba9a6005d7d00b24c9538c8a93cbd2f
parent7648a8524c3f20d79db50df069a87cfa0cd23f96 (diff)
downloadrneovim-1ff86aa634cc5b12e3f804f6594c36799acbf296.tar.gz
rneovim-1ff86aa634cc5b12e3f804f6594c36799acbf296.tar.bz2
rneovim-1ff86aa634cc5b12e3f804f6594c36799acbf296.zip
vim-patch:8.2.1770: invalid memory use when using SpellFileMissing autocmd
Problem: Invalid memory use when using SpellFileMissing autocmd. Solution: Add test case. (Dominique Pellé, closes vim/vim#7036) Fix using a window that was closed. https://github.com/vim/vim/commit/d569a9e74684cd17f9cea63e804281388728e513 Skip an assert because of #3027.
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/testdir/test_spell.vim24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 304fd30b36..1cefc532aa 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2327,11 +2327,11 @@ char *did_set_spelllang(win_T *wp)
}
}
}
+ redraw_later(wp, NOT_VALID);
theend:
xfree(spl_copy);
recursive = false;
- redraw_later(wp, NOT_VALID);
return ret_msg;
}
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim
index d0895a48b4..b768dc1814 100644
--- a/src/nvim/testdir/test_spell.vim
+++ b/src/nvim/testdir/test_spell.vim
@@ -131,6 +131,30 @@ foobar/?
set spell&
endfunc
+func Test_spell_file_missing()
+ let s:spell_file_missing = 0
+ augroup TestSpellFileMissing
+ autocmd! SpellFileMissing * let s:spell_file_missing += 1
+ augroup END
+
+ set spell spelllang=ab_cd
+ let messages = GetMessages()
+ " This message is not shown in Nvim because of #3027
+ " call assert_equal('Warning: Cannot find word list "ab.utf-8.spl" or "ab.ascii.spl"', messages[-1])
+ call assert_equal(1, s:spell_file_missing)
+
+ new XTestSpellFileMissing
+ augroup TestSpellFileMissing
+ autocmd! SpellFileMissing * bwipe
+ augroup END
+ call assert_fails('set spell spelllang=ab_cd', 'E797:')
+
+ augroup! TestSpellFileMissing
+ unlet s:spell_file_missing
+ set spell& spelllang&
+ %bwipe!
+endfunc
+
func Test_spelllang_inv_region()
set spell spelllang=en_xx
let messages = GetMessages()