« get me outta code hell

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/Root.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/Root.js')
-rw-r--r--ui/Root.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/Root.js b/ui/Root.js
index 22c2c97..d306a41 100644
--- a/ui/Root.js
+++ b/ui/Root.js
@@ -90,4 +90,11 @@ module.exports = class Root extends DisplayElement {
 
     this.cursorMoved()
   }
+
+  isChildOrSelfSelected(el) {
+    if (!this.selected) return false
+    if (this.selected === el) return true
+    if (this.selected.directAncestors.includes(el)) return true
+    return false
+  }
 }