cjk support wip
[fanfix.git] / src / jexer / TList.java
index f9e721621eda3a76c69f47d33c0132ca37f54722..a962f7cfe9eeee9b3ed579657964765add8bc772 100644 (file)
@@ -32,6 +32,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import jexer.bits.CellAttributes;
+import jexer.bits.StringUtils;
 import jexer.event.TKeypressEvent;
 import jexer.event.TMouseEvent;
 import static jexer.TKeypress.*;
@@ -338,8 +339,9 @@ public class TList extends TScrollableWidget {
 
         for (int i = 0; i < strings.size(); i++) {
             String line = strings.get(i);
-            if (line.length() > maxLineWidth) {
-                maxLineWidth = line.length();
+            int lineLength = StringUtils.width(line);
+            if (lineLength > maxLineWidth) {
+                maxLineWidth = lineLength;
             }
         }