fix: Fixed urlbar results not being able to be heuristic, b=no-bug, c=folders, tabs

This commit is contained in:
mr. m
2025-11-11 18:27:11 +01:00
parent 081efe6898
commit b48878a766
3 changed files with 25 additions and 13 deletions

View File

@@ -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;

View File

@@ -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);
}
}
}
}
}

View File

@@ -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.