diff options
author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-08-28 16:42:52 +0200 |
---|---|---|
committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-08-28 16:42:52 +0200 |
commit | 8af2f0f18350078ae8d70a62c95e161b2d43a0af (patch) | |
tree | 9c47d0b9f761afe95f1ed38711a077daab6a0622 | |
parent | 500a12c36f8112a7b66a5e10f0733b3374e3c1f0 (diff) | |
download | vis-spellcheck-8af2f0f18350078ae8d70a62c95e161b2d43a0af.tar.gz |
don't stop iterating over typos when an empty one is encountered
An iterator in lua stops if it returns nil.
This change will get a new typo from the unfiltered_iterator if
we encounter an empty one instead of returning nil.
-rw-r--r-- | spellcheck.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spellcheck.lua b/spellcheck.lua index de04cea..6a20172 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -84,9 +84,9 @@ local function typo_iter(text, typos, ignored) return function(foo, bar) repeat typo = unfiltered_iterator(iter_state) - until(not typo or not ignored[typo]) + until(not typo or (typo ~= "" and not ignored[typo])) - if typo and typo ~= "" then + if typo then -- to prevent typos from being found in correct words before them -- ("stuff stuf", "broken ok", ...) -- we match typos only when they are enclosed in non-letter characters. |