X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTText.java;h=4791fdc5e38e242e707a8ed97d64d618895463d1;hb=5dccc93977b5f3cbde6e791404e5e43ae540ff54;hp=60f0e585c9d4faede83c681011a97d8a27a4bbf0;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=nikiroo-utils.git diff --git a/src/jexer/TText.java b/src/jexer/TText.java index 60f0e58..4791fdc 100644 --- a/src/jexer/TText.java +++ b/src/jexer/TText.java @@ -33,6 +33,7 @@ import java.util.LinkedList; import java.util.List; import jexer.bits.CellAttributes; +import jexer.bits.StringUtils; import jexer.event.TKeypressEvent; import jexer.event.TMouseEvent; import static jexer.TKeypress.kbDown; @@ -184,7 +185,7 @@ public class TText extends TScrollableWidget { int topY = 0; for (int i = begin; i < lines.size(); i++) { String line = lines.get(i); - if (hScroller.getValue() < line.length()) { + if (hScroller.getValue() < StringUtils.width(line)) { line = line.substring(hScroller.getValue()); } else { line = ""; @@ -323,7 +324,7 @@ public class TText extends TScrollableWidget { * @param line new line to add */ public void addLine(final String line) { - if (text.length() == 0) { + if (StringUtils.width(text) == 0) { text = line; } else { text += "\n\n"; @@ -338,8 +339,8 @@ public class TText extends TScrollableWidget { private void computeBounds() { maxLineWidth = 0; for (String line : lines) { - if (line.length() > maxLineWidth) { - maxLineWidth = line.length(); + if (StringUtils.width(line) > maxLineWidth) { + maxLineWidth = StringUtils.width(line); } }