Skip to content

Commit

Permalink
fix(languages): U+00A0 nbsp in French causes unexpected word breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Dec 29, 2023
1 parent 84771ae commit b93975c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions languages/fr.lua
Expand Up @@ -223,9 +223,13 @@ function SILE.nodeMakers.fr:iterator (items)
local removed = 0
for k = 1, #items do
if self:mustRemove(k, items) then
removed = removed + 1
-- the index is actually a character position in the byte stream.
-- So we need to take its actual byte length into account.
-- For instance, U+00A0 NBSP is 2 bytes long (0xC2 0xA0) in UTF-8.
removed = removed + string.len(items[k].text)
else
items[k].index = items[k].index - removed -- index has changed due to removals
-- index has changed due to removals
items[k].index = items[k].index - removed
table.insert(cleanItems, items[k])
end
end
Expand Down

0 comments on commit b93975c

Please sign in to comment.