« get me outta code hell

An assortment of changes to how selected/unselected works - 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/FocusElement.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-04 22:50:39 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-04 22:50:39 -0300
commiteebff4fbbac489f96954f05d6d0d838c62a8e6c7 (patch)
treed98e02291111578f298460b5c4e250c5959036e6 /ui/form/FocusElement.js
parent4ddc3ece7d713633347f2702c30806b4a2e18ca4 (diff)
An assortment of changes to how selected/unselected works
Diffstat (limited to 'ui/form/FocusElement.js')
-rw-r--r--ui/form/FocusElement.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/form/FocusElement.js b/ui/form/FocusElement.js
index 9061838..23c2e02 100644
--- a/ui/form/FocusElement.js
+++ b/ui/form/FocusElement.js
@@ -11,11 +11,11 @@ module.exports = class FocusElement extends DisplayElement {
     this.cursorY = 0
   }
 
-  focused() {
+  selected() {
     // Should be overridden in subclasses.
   }
 
-  unfocused() {
+  unselected() {
     // Should be overridden in subclasses.
   }
 
@@ -36,8 +36,8 @@ module.exports = class FocusElement extends DisplayElement {
   }
 
   get isSelected() {
-    const selected = this.root.selected
-    return selected && [selected, ...selected.directAncestors].includes(this)
+    const selected = this.root.selectedElement
+    return !!(selected && [selected, ...selected.directAncestors].includes(this))
   }
 
   get absCursorX() { return this.absX + this.cursorX }