aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spell.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-06-11 22:43:22 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-06-12 13:06:50 -0400
commit72b512bd530afe7937d5ed8a9b68da889669bf80 (patch)
treee84aa74823c0847b1934f5cca7517d5db6b3d0a3 /src/nvim/spell.c
parent82d1c29bfd652c74fad8b9a4d403ffdf45c05321 (diff)
downloadrneovim-72b512bd530afe7937d5ed8a9b68da889669bf80.tar.gz
rneovim-72b512bd530afe7937d5ed8a9b68da889669bf80.tar.bz2
rneovim-72b512bd530afe7937d5ed8a9b68da889669bf80.zip
vim-patch:8.2.0945: cannot use "z=" when 'spell' is off
Problem: Cannot use "z=" when 'spell' is off. Solution: Make "z=" work even when 'spell' is off. (Christian Brabandt, Gary Johnson, closes vim/vim#6227) https://github.com/vim/vim/commit/152e79e94bb935e75b866bd55479648cde11066a
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r--src/nvim/spell.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 880c159ce7..771c2106db 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1343,7 +1343,7 @@ static bool no_spell_checking(win_T *wp)
{
if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL
|| GA_EMPTY(&wp->w_s->b_langp)) {
- EMSG(_("E756: Spell checking is not enabled"));
+ EMSG(_(e_no_spell));
return true;
}
return false;
@@ -2771,9 +2771,17 @@ void spell_suggest(int count)
int selected = count;
int badlen = 0;
int msg_scroll_save = msg_scroll;
+ const int wo_spell_save = curwin->w_p_spell;
- if (no_spell_checking(curwin))
+ if (!curwin->w_p_spell) {
+ did_set_spelllang(curwin);
+ curwin->w_p_spell = true;
+ }
+
+ if (*curwin->w_s->b_p_spl == NUL) {
+ EMSG(_(e_no_spell));
return;
+ }
if (VIsual_active) {
// Use the Visually selected text as the bad word. But reject
@@ -2966,6 +2974,7 @@ void spell_suggest(int count)
spell_find_cleanup(&sug);
xfree(line);
+ curwin->w_p_spell = wo_spell_save;
}
// Check if the word at line "lnum" column "col" is required to start with a