-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Let history-incremental-search-*
list rows in chronological order
#334
Comments
First off, it's not a bug; it's a feature. Although, indeed, the documentation could be better. If you want to have the results sorted in chronological order, just press ↑. |
I have no idea what you mean with "partial" vs "complete" searches. Care to explain?
I'm not sure what you mean with that either. 🙂 |
Oh, interesting point about "up arrow" at the search prompt. I'll have to get used to that--there's history search in order, but not live anymore. I think this will work about as well, though I'm used to seeing the most recent match right away, as I type. When I wrote "partial" search, I meant a search whose terms, from the user's perspective, have not been fully input. When doing an incremental search, the system should assume the search is not complete. If I typed "a" into a search prompt then confirmed, short results starting with "a" would be a reasonable answer. But if I've just started to type, the system should not assume "a" is likely so be the full search string. It would be a better user interface for the system to always assume the search terms are incomplete and give results accordingly.
Looking at the code, it seems I assumed more logic than it actually uses. I assumed results were ordered by a point ranking system (fuzzy ordering based on how good of a match it is), but are they just ordered by length? My suggestion isn't relevant in that case. That aside, I find the longer commands in history harder to remember than the shorter ones. The shorter command history items are things I would not want command history for, like "cd ffmpeg-git" and "killall ffmpeg". What's the use case for putting short commands at the top? |
I see your point there. It's something I've gone back and forth on in the past. I suppose I could make it configurable.
|
Another way of describing "partial search" is: when I do an incremental search, I consider it as having an implicit "*" wildcard at the end. As such, a shorter string is not a more exact match. But arguably a command where the term occurs earlier is a more exact match, and a command where the term matches with a left word boundary is a better match. For example, "n" matches "null" better than "end". But IMO that's a separate issue, and ranking algorithms are easy to extend after the initial refactor (to sort based on more than one factor) is done. What do you think about swapping the orderings of
This makes a lot of sense with |
history-incremental-search-*
list rows in chronological order
I am currently testing |
Thanks! Do you intend to give the |
Thanks, but no thanks. I’ve gotten feedback before that users expect ⬆️ to produce results in (anti-)chronological order. 🙂 |
It's there now, plus some other minor improvements to the incremental history search. Enjoy! PS: If you indeed enjoy using my software, please consider sponsoring me. 🙂 |
zsh-autocomplete
version: f3aa3b0...
above, copy-paste the contents of your terminal here:
History incremental search shows commands in the documented order ("Live history search, from newest to oldest") until typing starts (correct behavior):
Here, after I type "echo", the order changes and does not show me the most recent command first.
I noticed the shortest commands are shown first. I guess that's because they are deemed better matches. That heuristic makes sense for matching a complete search, but not a partial search! Partial searches are expected to be much shorter than the text they match.
I suggest history results be shown in order as the documentation states. Perhaps the ranking algorithm should be turned on by configuration, and ranking improvements could be filed as a separate issue?
Or could this be solved by ranking all perfect substring matches equally? In that case heuristics like edit distance would only be used when the incremental search is not an exact (substring) match.
The text was updated successfully, but these errors were encountered: