From b11a8c1b5d3985479351b34f2078d490cbf59e90 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Mon, 22 May 2023 11:07:55 +0200 Subject: [PATCH] fix(highlight): remove unnecessary assignment to char_attr for 'spell' (#23713) --- src/nvim/drawline.c | 3 --- test/functional/ui/spell_spec.lua | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index dc90be36be..863d237062 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2046,9 +2046,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, v = (ptr - line); if (has_spell && v >= word_end && v > cur_checked_col) { spell_attr = 0; - if (!attr_pri) { - wlv.char_attr = hl_combine_attr(wlv.char_attr, syntax_attr); - } if (c != 0 && ((!has_syntax && !no_plain_buffer) || can_spell)) { char *prev_ptr; char *p; diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua index 15819aef40..0f553d4a9b 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -254,4 +254,19 @@ describe("'spell'", function() ]]) end) + it('and syntax does not clear extmark highlighting at the start of a word', function() + screen:try_resize(43, 3) + command([[ + set spell + syntax match Constant "^.*$" + call setline(1, "This is some text without any spell errors.") + ]]) + local ns = meths.create_namespace("spell") + curbufmeths.set_extmark(ns, 0, 0, { hl_group = 'WarningMsg', end_col = 43 }) + screen:expect([[ + {6:^This is some text without any spell errors.}| + {0:~ }| + | + ]]) + end) end)