Skip to content

Commit d979972

Browse files
committed
Update comment and add an InsertLeave autocmd
1 parent a6e2ff8 commit d979972

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lua/scrollview/signs/spell.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,20 @@ function M.init(enable)
127127
local expect_sign = spellbadword[1] ~= ''
128128
-- Wait until leaving insert mode before showing spell signs. This way,
129129
-- signs won't show while entering a word (which will temporarily be
130-
-- misspelled).
130+
-- misspelled). Such a word won't be highlighted by Neovim, but it will
131+
-- be returned by spellbadword(). The approach here could still cause a
132+
-- synchronization issue, since the word would be highlighted when
133+
-- starting to type the next word, and there would be no sign until
134+
-- leaving insert mode. But I couldn't find a preferable solution, since
135+
-- there doesn't appear to be any functions for retrieving just the
136+
-- highlighted misspelled words.
131137
if expect_sign then
138+
api.nvim_create_autocmd('InsertLeave', {
139+
callback = function()
140+
scrollview.refresh()
141+
end,
142+
once = true,
143+
})
132144
return
133145
end
134146
local idx = -1

0 commit comments

Comments
 (0)