Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ranked match: prefer input order over alphabetical order for user-specified completions #5035

Merged
merged 2 commits into from
Dec 12, 2023

Commits on Dec 2, 2023

  1. Reuse for_n_best when sorting values from complete options

    While at it, remove a needless reserve() call and reserve an extra slot
    because "InsertCompleter::try_complete" might add one more element.
    krobelus committed Dec 2, 2023
    Configuration menu
    Copy the full SHA
    d6215dc View commit details
    Browse the repository at this point in the history
  2. ranked match: prefer input order over alphabetical order for user-spe…

    …cified completions
    
    When using either of
    
    	set-option g completers option=my_option
    	prompt -shell-script-candidates ...
    
    While the search text is empty, the completions will be sorted
    alphabetically.
    This is bad because it means the most important entries are not listed
    first, making them harder to select or even spot.
    
    Let's apply input order before resorting to sorting alphabetically.
    
    In theory there is a more elegant solution: sort candidates (except
    if they're user input) before passing them to RankedMatch, and then
    always use stable sort. However that doesn't work because we use a
    heap which doesn't support stable sort.
    
    Closes mawww#1709, mawww#4813
    krobelus committed Dec 2, 2023
    Configuration menu
    Copy the full SHA
    658c338 View commit details
    Browse the repository at this point in the history