-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
setopt HIST_IGNORE_ALL_DUPS breaks history completion. #280
Comments
I'm unable to reproduce this with the exact steps you've given. Are you sure you've executed them to the letter? In particular, it's important that you first do |
My mistake; it also requires setopt HIST_FIND_NO_DUPS. |
Works fine for me: % cd $(mktemp -d)
exec env -i PS1='%# ' HOME=$PWD TERM=$TERM zsh -f
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 59 (delta 0), reused 29 (delta 0), pack-reused 0
Receiving objects: 100% (59/59), 1.60 MiB | 2.62 MiB/s, done.
% source zsh-autocomplete/zsh-autocomplete.plugin.zsh
% setopt histfindnodups
% echo blah
blah
% pwd
/private/var/folders/24/37_vm48s2tz9bhmj1rzffvl40000gn/T/tmp.nukaIfV0
% echo blah
blah
% setopt histignorealldups
% setopt histignorealldups;
1 git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
2 source zsh-autocomplete/zsh-autocomplete.plugin.zsh
3 setopt histfindnodups
5 pwd
6 echo blah
7 setopt histignorealldups |
I don't know how we're different:
|
Can you try that again, but before you press ⬆️, run this: functions -t _autocomplete.history_lines |
|
I'm able to reproduce it now and I know how to fix it. |
Fixed. If you use my software on a regular basis, please consider sponsoring me. 🙂 |
zsh-autocomplete
version: 7f44a6dThe problem is that HIST_IGNORE_ALL_DUPS removes items from the $history array, but there are multiple places in the code that cycle through all the indexes, starting with line 22 of history_lines:
[[ -v events[$history[$histno]] ]]
If you insert an "echo $histno" just before that line, you can see which index it fails on and then you can see with the "history" command that that index cooresponds to the index of the first "echo blah" above which was removed when the second instance was entered.
The text was updated successfully, but these errors were encountered: