mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 00:46:30 +00:00
fix(spell): extmark with spell=false should disable spell (#23400)
This commit is contained in:
@@ -1206,8 +1206,8 @@ static void decor_spell_nav_start(win_T *wp)
|
||||
decor_redraw_reset(wp, &decor_state);
|
||||
}
|
||||
|
||||
static bool decor_spell_nav_col(win_T *wp, linenr_T lnum, linenr_T *decor_lnum, int col,
|
||||
char **decor_error)
|
||||
static TriState decor_spell_nav_col(win_T *wp, linenr_T lnum, linenr_T *decor_lnum, int col,
|
||||
char **decor_error)
|
||||
{
|
||||
if (*decor_lnum != lnum) {
|
||||
decor_providers_invoke_spell(wp, lnum - 1, col, lnum - 1, -1, decor_error);
|
||||
@@ -1215,7 +1215,7 @@ static bool decor_spell_nav_col(win_T *wp, linenr_T lnum, linenr_T *decor_lnum,
|
||||
*decor_lnum = lnum;
|
||||
}
|
||||
decor_redraw_col(wp, col, col, false, &decor_state);
|
||||
return decor_state.spell == kTrue;
|
||||
return decor_state.spell;
|
||||
}
|
||||
|
||||
static inline bool can_syn_spell(win_T *wp, linenr_T lnum, int col)
|
||||
@@ -1352,9 +1352,18 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
|
||||
: p - buf) > wp->w_cursor.col)) {
|
||||
col = (colnr_T)(p - buf);
|
||||
|
||||
bool can_spell = (!has_syntax && (wp->w_s->b_p_spo_flags & SPO_NPBUFFER) == 0)
|
||||
|| decor_spell_nav_col(wp, lnum, &decor_lnum, col, &decor_error)
|
||||
|| (has_syntax && can_syn_spell(wp, lnum, col));
|
||||
bool no_plain_buffer = (wp->w_s->b_p_spo_flags & SPO_NPBUFFER) != 0;
|
||||
bool can_spell = !no_plain_buffer;
|
||||
switch (decor_spell_nav_col(wp, lnum, &decor_lnum, col, &decor_error)) {
|
||||
case kTrue:
|
||||
can_spell = true; break;
|
||||
case kFalse:
|
||||
can_spell = false; break;
|
||||
case kNone:
|
||||
if (has_syntax) {
|
||||
can_spell = can_syn_spell(wp, lnum, col);
|
||||
}
|
||||
}
|
||||
|
||||
if (!can_spell) {
|
||||
attr = HLF_COUNT;
|
||||
|
Reference in New Issue
Block a user