From b48878a766bed15f9a8f07ad036a7abd6150317b Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Tue, 11 Nov 2025 18:27:11 +0100 Subject: [PATCH] fix: Fixed urlbar results not being able to be heuristic, b=no-bug, c=folders, tabs --- src/zen/folders/ZenFolders.mjs | 3 +++ src/zen/tabs/ZenPinnedTabManager.mjs | 24 ++++++++++++++------- src/zen/urlbar/ZenUBActionsProvider.sys.mjs | 11 +++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/zen/folders/ZenFolders.mjs b/src/zen/folders/ZenFolders.mjs index 3d181132b..108fe4d90 100644 --- a/src/zen/folders/ZenFolders.mjs +++ b/src/zen/folders/ZenFolders.mjs @@ -1157,6 +1157,9 @@ Services.prefs.getIntPref('zen.view.drag-and-drop.drop-inside-lower-threshold') / 100; const dropElementGroup = dropElement.group; + if (!dropElementGroup) { + return { dropElement, colorCode, dropBefore }; + } const isSplitGroup = dropElement?.group?.hasAttribute('split-view-group'); let firstGroupElem = dropElementGroup.querySelector('.zen-tab-group-start').nextElementSibling; diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 779f3566b..3436ba178 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -447,7 +447,7 @@ case 'TabGroupCollapse': case 'TabGroupExpand': case 'ZenFolderChangedWorkspace': - this.#updateGroupInfo(event.originalTarget); + this.#updateGroupInfo(event.originalTarget, action); break; case 'TabGrouped': this.#onTabGrouped(event); @@ -523,7 +523,7 @@ ZenPinnedTabsStorage.removeTabFromGroup(tabPinId, /* position */ tab._pPos); } - async #updateGroupInfo(group) { + async #updateGroupInfo(group, action) { if (!group?.isZenFolder) { return; } @@ -537,12 +537,20 @@ groupPin.parentUuid = group.group?.getAttribute('zen-pin-id') || null; groupPin.workspaceUuid = group.getAttribute('zen-workspace-id') || null; await this.savePin(groupPin); - for (const item of group.allItems) { - if (gBrowser.isTabGroup(item)) { - await this.#updateGroupInfo(item); - } else { - await this.#onTabMove(item); - } + switch (action) { + case 'ZenFolderRenamed': + case 'ZenFolderIconChanged': + case 'TabGroupCollapse': + case 'TabGroupExpand': + break; + default: + for (const item of group.allItems) { + if (gBrowser.isTabGroup(item)) { + await this.#updateGroupInfo(item, action); + } else { + await this.#onTabMove(item); + } + } } } } diff --git a/src/zen/urlbar/ZenUBActionsProvider.sys.mjs b/src/zen/urlbar/ZenUBActionsProvider.sys.mjs index 0ace9dcba..792bb4850 100644 --- a/src/zen/urlbar/ZenUBActionsProvider.sys.mjs +++ b/src/zen/urlbar/ZenUBActionsProvider.sys.mjs @@ -262,17 +262,18 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider { ...action.extraPayload, }); + const shouldBePrioritized = + zenUrlbarResultsLearner.shouldPrioritize(action.commandId) && !isPrefixed; let result = new lazy.UrlbarResult({ type: UrlbarUtils.RESULT_TYPE.DYNAMIC, source: UrlbarUtils.RESULT_SOURCE.ZEN_ACTIONS, payload, payloadHighlights, + heuristic: shouldBePrioritized, + suggestedIndex: !shouldBePrioritized + ? zenUrlbarResultsLearner.getDeprioritizeIndex(action.commandId) + : undefined, }); - if (zenUrlbarResultsLearner.shouldPrioritize(action.commandId) && !isPrefixed) { - result.heuristic = true; - } else { - result.suggestedIndex = zenUrlbarResultsLearner.getDeprioritizeIndex(action.commandId); - } result.commandId = action.commandId; if (!(isPrefixed && query.length < 2)) { // We dont want to record prefixed results, as the user explicitly asked for them.