Skip to content

Commit

Permalink
Update comment and add an InsertLeave autocmd
Browse files Browse the repository at this point in the history
  • Loading branch information
dstein64 committed Dec 15, 2024
1 parent a6e2ff8 commit d979972
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lua/scrollview/signs/spell.lua
Original file line number Diff line number Diff line change
@@ -127,8 +127,20 @@ function M.init(enable)
local expect_sign = spellbadword[1] ~= ''
-- Wait until leaving insert mode before showing spell signs. This way,
-- signs won't show while entering a word (which will temporarily be
-- misspelled).
-- misspelled). Such a word won't be highlighted by Neovim, but it will
-- be returned by spellbadword(). The approach here could still cause a
-- synchronization issue, since the word would be highlighted when
-- starting to type the next word, and there would be no sign until
-- leaving insert mode. But I couldn't find a preferable solution, since
-- there doesn't appear to be any functions for retrieving just the
-- highlighted misspelled words.
if expect_sign then
api.nvim_create_autocmd('InsertLeave', {
callback = function()
scrollview.refresh()
end,
once = true,
})
return
end
local idx = -1

0 comments on commit d979972

Please sign in to comment.