From f12869d5874685bfd89fd45763aa0f7af25284d1 Mon Sep 17 00:00:00 2001 From: chrox Date: Sat, 14 Sep 2013 18:40:00 +0800 Subject: [PATCH] split text string with even finer granularity --- frontend/ui/widget/text.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/ui/widget/text.lua b/frontend/ui/widget/text.lua index c063cc1ac..fe6f50adb 100644 --- a/frontend/ui/widget/text.lua +++ b/frontend/ui/widget/text.lua @@ -153,11 +153,13 @@ function TextBoxWidget:_getVerticalList(alg) -- build horizontal list local h_list = {} for words in self.text:gmatch("[\32-\127\192-\255]+[\128-\191]*") do - for w in words:gsplit("%s+", true) do - local word_box = {} - word_box.word = w - word_box.width = sizeUtf8Text(0, Screen:getWidth(), self.face, w, true).x - table.insert(h_list, word_box) + for word in words:gsplit("%s+", true) do + for w in word:gsplit("%p+", true) do + local word_box = {} + word_box.word = w + word_box.width = sizeUtf8Text(0, Screen:getWidth(), self.face, w, true).x + table.insert(h_list, word_box) + end end end