From d4514219ed42328884bc0f877497b3b85272cc97 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 21 Jun 2021 21:26:26 +0200 Subject: [PATCH] Fix: Use correct child count when ordering right box Previously the `panelBoxChildCount` would just be the child count of the right box before new items got added, which would result in incorrect indices for new child insertions being used (in `panel.insert_child_at_index`), since `panelBoxChildCount` would just account for the current children, not for new ones. This resulted in the following issue: When you used the settings to move an item from e.g. the middle box to the right box, the right box would get ordered incorrectly. So fix this issue by getting the max of the right boxes current children and the `validBoxOrder.length`. --- src/extension.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index efacc6d..a5e1f7e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -430,7 +430,7 @@ class Extension { // This could happen, when the box order gets set to a permutation // of an outdated box order. case "right": - panelBoxChildCount = panelBox.get_children().length; + panelBoxChildCount = Math.max(panelBox.get_children().length, validBoxOrder.length); for (let i = 0; i < validBoxOrder.length; i++) { const role = validBoxOrder[validBoxOrder.length - 1 - i]; // Get the indicator container associated with the current role.