« get me outta code hell

Save/restore selection on Dialog open/close - 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
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-15 15:37:01 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-15 15:37:01 -0300
commit8257ee6027ccb5e43d9f991eee598aaa45a710b4 (patch)
treeb5204f89043ca045b9ab2f1373e716a128986b54 /ui
parentb3fb0187f9c02cb98d98c41c076036ee2b528455 (diff)
Save/restore selection on Dialog open/close
Diffstat (limited to 'ui')
-rw-r--r--ui/Dialog.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/ui/Dialog.js b/ui/Dialog.js
index f2db43d..85ff087 100644
--- a/ui/Dialog.js
+++ b/ui/Dialog.js
@@ -31,6 +31,7 @@ module.exports = class Dialog extends FocusElement {
 
   open() {
     this.opened()
+    this.oldSelectedElement = this.root.selectedElement
     this.visible = true
     this.root.select(this)
     this.fixLayout()
@@ -39,6 +40,7 @@ module.exports = class Dialog extends FocusElement {
   close() {
     this.closed()
     this.visible = false
+    this.root.select(this.oldSelectedElement)
   }
 
   opened() {}