aboutsummaryrefslogtreecommitdiff
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorNomarian <nomarian@outlook.com>2025-10-09 11:15:28 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-10-12 21:00:37 +0200
commit715441b44537c3ace7facfa722a3552c3a630fe4 (patch)
tree457f5dbff7337e7f1f558c73b6c3cb6593386bff /spellcheck.lua
parent0d46df394bbc27b4898e718f259f438139e04c44 (diff)
downloadvis-spellcheck-715441b44537c3ace7facfa722a3552c3a630fe4.tar.gz
vis-spellcheck-715441b44537c3ace7facfa722a3552c3a630fe4.zip
typo_iter gmatch [^\n]+ instead and one less check on getting typos
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index 0e3a0a6..12e8d7b 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -114,14 +114,14 @@ end
-- Which will return the next typo and its start and finish in the text, starting by 1.
local function typo_iter(text, typos, ignored) -- luacheck: ignore ignored
local index = 1
- local unfiltered_iterator, iter_state = typos:gmatch'%S+'
+ local unfiltered_iterator, iter_state = typos:gmatch'[^\n]+'
return function()
local typo
repeat
typo = unfiltered_iterator(iter_state)
if not typo then return end
- until typo ~= '' and not ignored[typo]
+ until not ignored[typo]
local start, finish
-- special case for typos at the beginning of the text