mirror of
https://github.com/vim/vim.git
synced 2025-10-13 06:54:15 -04:00
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)
This commit is contained in:
@@ -7596,9 +7596,30 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
char_u *word = (char_u *)"";
|
||||
hlf_T attr = HLF_COUNT;
|
||||
int len = 0;
|
||||
#ifdef FEAT_SPELL
|
||||
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));
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
{
|
||||
#ifdef FEAT_SPELL
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_SPELL
|
||||
if (argvars[0].v_type == VAR_UNKNOWN)
|
||||
@@ -7611,7 +7632,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
curwin->w_set_curswant = TRUE;
|
||||
}
|
||||
}
|
||||
else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL)
|
||||
else if (*curbuf->b_s.b_p_spl != NUL)
|
||||
{
|
||||
char_u *str = tv_get_string_chk(&argvars[0]);
|
||||
int capcol = -1;
|
||||
@@ -7633,6 +7654,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
}
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
|
||||
list_append_string(rettv->vval.v_list, word, len);
|
||||
@@ -7658,13 +7680,32 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
int i;
|
||||
listitem_T *li;
|
||||
int need_capital = FALSE;
|
||||
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));
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
{
|
||||
#ifdef FEAT_SPELL
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_SPELL
|
||||
if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL)
|
||||
if (*curwin->w_s->b_p_spl != NUL)
|
||||
{
|
||||
str = tv_get_string(&argvars[0]);
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
@@ -7701,6 +7742,7 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
}
|
||||
ga_clear(&ga);
|
||||
}
|
||||
curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user