diff options
-rwxr-xr-x | index.js | 2 | ||||
m--------- | tui-lib | 0 | ||||
-rw-r--r-- | ui.js | 23 |
3 files changed, 11 insertions, 14 deletions
diff --git a/index.js b/index.js index 694a384..c0e2932 100755 --- a/index.js +++ b/index.js @@ -69,7 +69,7 @@ async function main() { appElement.grouplikeListingElement.loadGrouplike(grouplike) - root.select(appElement.form) + root.select(appElement) if (process.argv[2]) { appElement.handlePlaylistSource(process.argv[2]) diff --git a/tui-lib b/tui-lib -Subproject 1076bd5e65658a0e846a7892cee787ade7660bb +Subproject eebff4fbbac489f96954f05d6d0d838c62a8e6c diff --git a/ui.js b/ui.js index 8d912a2..4ad09e9 100644 --- a/ui.js +++ b/ui.js @@ -109,6 +109,10 @@ class AppElement extends FocusElement { this.setupDialog(this.alertDialog) } + selected() { + this.root.select(this.form) + } + async handlePlaylistSource(source) { this.openPlaylistDialog.close() this.alertDialog.showMessage('Opening playlist...', false) @@ -547,7 +551,7 @@ class GrouplikeListingElement extends FocusElement { this.pathElement.w = this.contentW } - focused() { + selected() { this.root.select(this.form) } @@ -555,10 +559,6 @@ class GrouplikeListingElement extends FocusElement { return this.form.selectable } - get isSelected() { - return this.form.isSelected - } - keyPressed(keyBuf) { if (telc.isBackspace(keyBuf)) { this.loadParentGrouplike() @@ -669,11 +669,8 @@ class GrouplikeListingForm extends ListScrollForm { return Math.min(this.inputs.length, 1) } - get isSelected() { - return this.root.selected && this.root.selected.directAncestors.includes(this) - } - selectAndShow(item) { + // TODO: Make sure this is still working. const index = this.inputs.findIndex(inp => inp.item === item) if (index >= 0) { this.curIndex = index @@ -699,7 +696,7 @@ class GrouplikeItemElement extends Button { } drawTo(writable) { - if (this.isFocused) { + if (this.isSelected) { writable.write(ansi.invert()) } @@ -809,7 +806,7 @@ class PathItemElement extends FocusElement { this.addChild(this.arrowLabel) } - focused() { + selected() { this.root.select(this.button) } @@ -957,7 +954,7 @@ class OpenPlaylistDialog extends Dialog { this.button.y = 1 } - focused() { + selected() { this.root.select(this.form) } } @@ -978,7 +975,7 @@ class AlertDialog extends Dialog { this.pane.addChild(this.button) } - focused() { + selected() { this.root.select(this.button) } |