Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[fanfix.git] / src / jexer / ttree / TTreeViewWindow.java
index 2adf61681ab3857e26403da73cd23af0d2f769eb..f418383ecf43d637c14b81cceedd914b44b54179 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -34,6 +34,7 @@ import jexer.THScroller;
 import jexer.TScrollableWindow;
 import jexer.TVScroller;
 import jexer.TWidget;
+import jexer.bits.StringUtils;
 import jexer.event.TKeypressEvent;
 import jexer.event.TMouseEvent;
 import jexer.event.TResizeEvent;
@@ -190,6 +191,13 @@ public class TTreeViewWindow extends TScrollableWindow {
             return;
         }
 
+        // Give the shortcut bar a shot at this.
+        if (statusBar != null) {
+            if (statusBar.statusBarKeypress(keypress)) {
+                return;
+            }
+        }
+
         if (keypress.equals(kbShiftLeft)
             || keypress.equals(kbCtrlLeft)
             || keypress.equals(kbAltLeft)
@@ -294,7 +302,7 @@ public class TTreeViewWindow extends TScrollableWindow {
                 selectedRow++;
             }
 
-            int lineWidth = item.getText().length()
+            int lineWidth = StringUtils.width(item.getText())
                 + item.getPrefix().length() + 4;
             if (lineWidth > maxLineWidth) {
                 maxLineWidth = lineWidth;