« get me outta code hell

Remove FocusElement.isFocused, add isSelected - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/ui/form/FocusBox.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-04 21:19:19 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-04 21:19:21 -0300
commit4ddc3ece7d713633347f2702c30806b4a2e18ca4 (patch)
tree4177d66568d6138c2208b5b794ee932e403f3ac6 /ui/form/FocusBox.js
parent1076bd5e65658a0e846a7892cee787ade7660bb2 (diff)
Remove FocusElement.isFocused, add isSelected
FocusElement.isSelected behaves a little bit differently - basically
it's true if the current selected element is that element, OR any of the
ancestors of the current selected element is that element. It's also a
getter, so you can't directly override it (assigning to el.isSelected won't
work).
Diffstat (limited to 'ui/form/FocusBox.js')
-rw-r--r--ui/form/FocusBox.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/form/FocusBox.js b/ui/form/FocusBox.js
index 51e961b..69b5bf5 100644
--- a/ui/form/FocusBox.js
+++ b/ui/form/FocusBox.js
@@ -19,13 +19,13 @@ module.exports = class FocusBox extends FocusElement {
   }
 
   drawTo(writable) {
-    if (this.isFocused) {
+    if (this.isSelected) {
       writable.write(ansi.invert())
     }
   }
 
   didRenderTo(writable) {
-    if (this.isFocused) {
+    if (this.isSelected) {
       writable.write(ansi.resetAttributes())
     }
   }