Repository navigation
Add an option to sort by Levenshtein distance - #140
Merged
quantumsheep merged 3 commits intoOct 16, 2025
Merged
quantumsheep merged 3 commits into
quantumsheep merged 3 commits into
Conversation
This was referenced Jul 11, 2025
Closed
Owner
|
Hey ! Do you think you can split the PR in two ? One with the Levenshtein distance (which I think could be the default sorting method?), and one with the glob matching |
OmenWild
force-pushed
the
omen/sort-by-levenshtein-distance
branch
from
August 12, 2025 18:23
dfb3fb4 to
3af8343
Compare
Contributor
Author
|
I have reverted the glob matching, so this PR is only sorting by Levenshtein distance. |
quantumsheep
approved these changes
Oct 16, 2025
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
sshs 4.8.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## ✨ What's New ✨ ### Interface * **Reload with `Ctrl+R`** - sshs reads the configuration files again and updates the host list. A restart is not necessary. * **Pick your palette with `--color`** - the value is a Tailwind palette name, for example `blue`, `green`, or `rose`. * **Keep your order with `--no-sort`** - sshs shows the hosts in configuration file order. * **Sort by match score with `--sort-fancy`** - the best fuzzy match comes first ([#140](quantumsheep/sshs#140)). * **Select text in your terminal** - sshs does not capture the mouse any more. * **See the real destination** - sshs expands the `%h` and `%n` tokens in the destination column. ### Search * **Each word must match** - sshs divides the query at spaces. A host appears only when all the words match. * **Wider match scope** - the fuzzy score includes the name, the aliases, and the destination. * **Stable selection** - when the query changes, the selection returns to the top match. ### SSH configuration parser * Quoted values keep their `#` characters, and sshs removes the surrounding quotes. * `Match` block entries do not leak into the previous host. * Relative `Include` paths in the system file resolve against `/etc/ssh`. * `Include` recursion stops at a safe depth and does not overflow the stack. * Alias merging is blocked only when `HostName` depends on `%h` or `%n` ([#153](quantumsheep/sshs#153)). * Parser errors show the offending line. A missing configuration file gives a clear error. * A `Host` entry with no patterns does not cause a crash. ### Stability * No crash on `End` or `PageDown` when the host list is empty. * Page navigation moves by the visible table height. * Table columns use their computed widths. * When an SSH session exits with an error, sshs returns to the host list. ### Packaging and documentation * New installation instructions for Debian and Ubuntu. * New installation method for NetBSD ([#142](quantumsheep/sshs#142)). ## 🌟 New Contributors 🌟 * [@OmenWild](https://github.com/OmenWild) made their first contribution in [#140](quantumsheep/sshs#140) * [@0323pin](https://github.com/0323pin) made their first contribution in [#142](quantumsheep/sshs#142) * [@mwestza](https://github.com/mwestza) made their first contribution in [#153](quantumsheep/sshs#153) **See All the Changes:** [The full list of updates from version 4.7.2 to 4.8.0](quantumsheep/sshs@4.7.2...4.8.0) </pre> <p>View the full release notes at <a href="https://github.com/quantumsheep/sshs/releases/tag/4.8.0">https://github.com/quantumsheep/sshs/releases/tag/4.8.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!18010
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a feature to sort by the Levenshtein distance (minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into the other), which causes the best matches to float to the top.
For example, if I have hosts
foo-example,bar-example, andexample, and my search box isexam, thenexamplewill be at the top because it requires the fewest changes to match.I have tucked the change away behind a
--sort-fancyoption.Note, this is my first time ever using Rust, so I "vibe" coded with Cursor. As best I can tell, the changes seem to make sense, and definitely work, but I do not know if this is truly the best way.