« get me outta code hell

Save oldSelectedElement before calling Dialog.opened - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-15 15:38:32 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-15 15:38:34 -0300
commit68d5c75dce1c950468d07241261fb9f8c8e3d39b (patch)
treea932873f5d2bd21da9b5552523ee3f803c7d4545
parent8257ee6027ccb5e43d9f991eee598aaa45a710b4 (diff)
Save oldSelectedElement before calling Dialog.opened
The main purpose of Dialog.opened is to select an input in any case
(e.g. opened() { this.root.select(this.input) }) so it makes more
sense to save whichever element was selected before calling that.
-rw-r--r--ui/Dialog.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/Dialog.js b/ui/Dialog.js
index 85ff087..d200d08 100644
--- a/ui/Dialog.js
+++ b/ui/Dialog.js
@@ -30,8 +30,8 @@ module.exports = class Dialog extends FocusElement {
   }
 
   open() {
-    this.opened()
     this.oldSelectedElement = this.root.selectedElement
+    this.opened()
     this.visible = true
     this.root.select(this)
     this.fixLayout()