Skip to content

Rank an app above the menu actions that manage it - #11730

Open
ivorycrayon wants to merge 1 commit into
omacom:quattrofrom
ivorycrayon:fix/menu-app-outranks-managers
Open

ivorycrayon wants to merge 1 commit into
omacom:quattrofrom
ivorycrayon:fix/menu-app-outranks-managers

Conversation

@ivorycrayon

Copy link
Copy Markdown

Fixes #11614.

Typing chr in the menu ranks every Chrome row under Setup, Install and Remove above the installed Google Chrome app. Only the full word chrome reaches the whole-word tier that lets the app win.

searchScore() cannot fix this on its own. It sees one row at a time, and chr against the Chrome rows has the same shape as vi against Setup › Defaults › Editor › Vim: the query starts the whole label of the action and prefixes the second word of an app (Google Chrome, Document Viewer). Any tier that lifts Chrome lifts Document Viewer over Vim by the same amount. That was #11615, closed for exactly this reason.

What separates the two is that "Chrome" is a word of the app's own label and "Vim" is no word of "Document Viewer". That is only visible across the result set, so this adds one pass in rebuildDisplay() over the matched rows: an action whose whole label is a word of a matching app sorts directly behind that app. Menus and links keep their place, since "Browser" is a word of every browser and a group is not a manager of one.

On this machine (Google Chrome installed, no Chromium), chr before and after:

before after
1 Setup › Defaults › Browser › Chromium Setup › Defaults › Browser › Chromium
2 Setup › Defaults › Browser › Chrome Install › Service › Chromium Account
3 Install › Service › Chromium Account Apps › Google Chrome
4 Remove › Browser › Chrome Remove › Browser › Chrome
5 Apps › Google Chrome Setup › Defaults › Browser › Chrome

The two Chromium rows stay ahead: the query starts their whole label and they share no word with the app, which is the Vim shape, and nothing text-based should touch it. Whether Setup › Defaults › Browser › * should show for browsers that are not installed is a separate question; every row in that group is unguarded today.

Sweep: every 2 to 6 letter prefix of every word in every visible label, ranked with the real menu, real guards, the font and power-profile provider rows, and the installed apps here plus 68 synthetic ones covering every browser, editor and service the menu manages. 1046 queries, 7 changed top-5 lists:

  • ch, chr, chro, chrom: Google Chrome above its Chrome rows (this issue)
  • edg: Microsoft Edge above its Edge rows (same shape)
  • ed: Menu Editor enters at 5, since the Edge rows moved down
  • tex: Sublime Text swaps with Trigger › Capture › Text

The last one is the cost of the heuristic: an action that shares a word with an installed app but does not manage it moves one slot, to directly behind that app. Update › Channel › Edge does the same behind Microsoft Edge. Both stay in the top five.

Tests cover the Chrome case, the Vim non-case, the Browser group non-case, and that Menu.qml runs the pass over every search row through the shared model. test/shell.d/menu-test.sh passes.

A short prefix of an app's later word ("chr" for Google Chrome) starts
the whole label of the Chrome rows under Setup, Install and Remove, so
searchScore puts all three ahead of the app. Only the full word "chrome"
reaches the whole-word tier that lets the app win.

No per-row tier fixes this. "chr" against Chrome and "vi" against Vim
are the same shape to a scorer that sees one row, so any tier that
lifts Google Chrome over its Chrome rows lifts Document Viewer over Vim
by the same amount. What separates them is that "Chrome" is a word of
the app's own label and "Vim" is not, which is only visible across the
result set.

Add a pass over the matched rows in rebuildDisplay: an action whose
whole label is a word of a matching app sorts directly behind that app.
Menus and links are left alone, since "Browser" is a word of every
browser. Swept over every 2-6 letter word prefix of the shipped menu
with 114 apps, the pass changes 7 of 1046 top-5 lists: the Chrome and
Edge cases it is for, and two one-slot moves where an unrelated action
shares a word with an installed app (Update > Channel > Edge behind
Microsoft Edge, Trigger > Capture > Text behind Sublime Text).

Fixes omacom#11614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu search: installed app loses short-prefix ranking to same-labeled menu actions (e.g. "chr" for Google Chrome)

1 participant