From 4ec41ab7af3166e20fc3300e39ec5327354787b4 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 10 Jan 2019 00:34:17 -0400 Subject: :disgust: Fix some selection issues * Menus opened from the queue wouldn't work before. Now they do. (Well, there's no code for them yet, but there was when I was testing.) * Rebuilding the items of a listing while it's selected doesn't reset the selection (i.e. select AppElement -> Tabber -> left pane). So you can remove an item from the queue and have focus remain on the queue, at the index where the item you removed was. --- ui.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ui.js b/ui.js index 3d71d24..4d6b637 100644 --- a/ui.js +++ b/ui.js @@ -966,9 +966,9 @@ class GrouplikeListingElement extends Form { const wasSelected = this.isSelected const form = this.form - while (form.inputs.length) { - form.removeInput(form.inputs[0], true, {fixLayout: false}) - } + // Just outright scrap the old items - don't deal with any selection stuff + // (as a result of removeInput) yet. + form.inputs = [] const parent = this.grouplike[parentSymbol] if (parent) { @@ -2062,10 +2062,13 @@ class ContextMenu extends FocusElement { } clearItems() { - const inputs = this.form.inputs.slice() - for (const input of inputs) { - this.form.removeInput(input) - } + // Abhorrent hack - just erases children from memory. Leaves children + // thinking they've still got a parent, though. (Necessary to avoid crazy + // select() loops that probably explode the world... speaking of things + // to forget, that one time when I was figuring out menus in the queue. + // This makes them work.) + this.form.inputs = [] + this.form.children = [] } fixLayout() { -- cgit 1.3.0-6-gf8a5