diff src/spellsuggest.c @ 20786:90b96fa35e4b v8.2.0945

patch 8.2.0945: cannot use "z=" when 'spell' is off Commit: https://github.com/vim/vim/commit/152e79e94bb935e75b866bd55479648cde11066a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 10 15:32:08 2020 +0200 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 #6227)
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Jun 2020 15:45:04 +0200
parents aadd1cae2ff5
children e01b20e3a720
line wrap: on
line diff
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -471,9 +471,19 @@ spell_suggest(int count)
     int		selected = count;
     int		badlen = 0;
     int		msg_scroll_save = msg_scroll;
-
-    if (no_spell_checking(curwin))
+    int		wo_spell_save = curwin->w_p_spell;
+
+    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)
     {
@@ -686,6 +696,7 @@ spell_suggest(int count)
     spell_find_cleanup(&sug);
 skip:
     vim_free(line);
+    curwin->w_p_spell = wo_spell_save;
 }
 
 /*