aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-09-24 07:13:56 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2020-09-24 08:09:38 +0200
commitca28cf5362c9f8cfcc60e28e20c2d455c5c37c77 (patch)
tree3727841c4d139c51313c6d6d74b9c2fd28bbce1c
parent0b42e3fedb55bd6bfbc02515b31f9144518a8909 (diff)
downloadrneovim-ca28cf5362c9f8cfcc60e28e20c2d455c5c37c77.tar.gz
rneovim-ca28cf5362c9f8cfcc60e28e20c2d455c5c37c77.tar.bz2
rneovim-ca28cf5362c9f8cfcc60e28e20c2d455c5c37c77.zip
vim-patch:8.2.1678: crash when using ":set" after ":ownsyntax"
Problem: Crash when using ":set" after ":ownsyntax". Solution: Make sure 'spelloptions' is not NULL. (closes vim/vim#6950) https://github.com/vim/vim/commit/d1f76afaf963be706697279ab0570ffcb8a1f2fc
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/testdir/test_syntax.vim4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 4aa7c21ce4..9a9cc45c6b 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5588,9 +5588,11 @@ void ex_ownsyntax(exarg_T *eap)
hash_init(&curwin->w_s->b_keywtab_ic);
// TODO: Keep the spell checking as it was. NOLINT(readability/todo)
curwin->w_p_spell = false; // No spell checking
+ // make sure option values are "empty_option" instead of NULL
clear_string_option(&curwin->w_s->b_p_spc);
clear_string_option(&curwin->w_s->b_p_spf);
clear_string_option(&curwin->w_s->b_p_spl);
+ clear_string_option(&curwin->w_s->b_p_spo);
clear_string_option(&curwin->w_s->b_syn_isk);
}
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index 85ee42420e..2404f113d9 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -369,7 +369,11 @@ func Test_ownsyntax()
call setline(1, '#define FOO')
syntax on
set filetype=c
+
ownsyntax perl
+ " this should not crash
+ set
+
call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name'))
call assert_equal('c', b:current_syntax)
call assert_equal('perl', w:current_syntax)