Skip to content

Commit 4ba32ac

Browse files
committed
Fix issue with combined words
1 parent ca17297 commit 4ba32ac

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

richtext/richtext.lua

+13-12
Original file line numberDiff line numberDiff line change
@@ -543,31 +543,32 @@ function M.create(text, font, settings)
543543
if not settings.dryrun then
544544
for i=1,word_count do
545545
local word = words[i]
546-
create_node(word, settings.parent)
547-
gui.set_pivot(word.node, pivot)
548-
549-
-- assign layer
550-
local layer = get_layer(word, settings.layers)
551-
if layer then
552-
gui.set_layer(word.node, layer)
546+
if not word.delete then
547+
create_node(word, settings.parent)
548+
gui.set_pivot(word.node, pivot)
549+
local layer = get_layer(word, settings.layers)
550+
if layer then
551+
gui.set_layer(word.node, layer)
552+
end
553553
end
554554
end
555555
end
556556

557557
-- compact words table
558+
-- delete words (and associated nodes if they exist)
558559
local j = 1
559560
for i = 1, word_count do
560561
local word = words[i]
561562
if not word.delete then
562563
words[j] = word
563564
j = j + 1
565+
else
566+
words[i] = nil
567+
if word.node then
568+
gui.delete_node(word.node)
569+
end
564570
end
565571
end
566-
-- delete words (and associated nodes if they exist)
567-
for i = j, word_count do
568-
local word = words[i]
569-
words[i] = nil
570-
end
571572

572573
return words, text_metrics
573574
end

0 commit comments

Comments
 (0)