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

Up arrow in history menu always cycling - not allowing older entries to be viewed #652

Open
poopsicles opened this issue Oct 14, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@poopsicles
Copy link

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace

typeset VENDOR=apple
typeset OSTYPE=darwin21.0
typeset ZSH_PATCHLEVEL=zsh-5.8.1-0-g1a490c7
typeset -a _autocomplete__funcfiletrace=(
  /Users/fumnanya/zsh-repos/marlonrichert/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /Users/fumnanya/zsh-repos/znap/functions/.znap.source:34
  /Users/fumnanya/zsh-repos/znap/functions/.znap.source:37
  /Users/fumnanya/zsh-repos/znap/functions/znap:27
  /Users/fumnanya/.zshrc:21
  zsh:0
)

% git -C ~autocomplete log --oneline -n1

afc5afd (grafted, HEAD -> main, origin/main, origin/HEAD) Add configuration note for NixOS users
  • Operating system: macOS Monterey 12.7 (21G816)
  • Terminal emulator: iTerm2 Build 3.4.20

Steps to reproduce

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git

Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 55 (delta 0), reused 35 (delta 0), pack-reused 0
Receiving objects: 100% (55/55), 1.64 MiB | 1.66 MiB/s, done.

% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
% ls
zsh-autocomplete

# do that ten or so times - enough for the history to be more than half the screen
# press up-arrow
% ls;
    9  ls
   10  ls
   11  ls
   12  ls
   13  ls
   14  ls
   15  ls
   16  ls # <- this is selected

# keep pressing up until entry 9 is selected
# press up again, it cycles back to 16 instead of going to 8
Contents of ~autocomplete-log/YYYY-MM-DD.log (click to expand)
empty

The history menu that shows the last 16 items, along with the history search (invoked with Ctrl+R) loop between the bottom and top lines shown on the screen instead of showing older entries. I originally thought this might be intended behaviour, but #550 appears to be meant to implement this behaviour, so I'm not sure.

Screen.Recording.2023-10-14.at.15.08.58.mov
@poopsicles poopsicles added the bug Something isn't working label Oct 14, 2023
@jackiesogi
Copy link

I have the same problem, I think it will be perfect if it is fixed.

@0xluc
Copy link

0xluc commented Oct 23, 2023

Yep, same here

@Cyberozoc
Copy link

Just remove the source ~/Repos/zsh-autocomplete/zsh-autocomplete.plugin.zsh from .zshrc and add zsh-autocomplete to the plugins

@poopsicles
Copy link
Author

@Cyberozoc I use Znap for plugin management, not oh-my-zsh, so I don't think there's a "plugins" section of my .zshrc...

this is how it looks:

$ cat .zshrc
# get znap
source ~/zsh-repos/znap/znap.zsh

fpath+=~/.zfunc # completions dir
rustup completions zsh > ~/.zfunc/_rustup
rustup completions zsh cargo > ~/.zfunc/_cargo
poetry completions zsh > ~/.zfunc/_poetry

export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

setopt autocd
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'

# Download Znap, if it's not there yet.
[[ -r ~/zsh-repos/znap/znap.zsh ]] ||
    git clone --depth 1 -- \
        https://github.com/marlonrichert/zsh-snap.git ~/zsh-repos/znap

znap source marlonrichert/zsh-autocomplete
znap source zsh-users/zsh-autosuggestions

# tab and shift tab cycle through dir suggestions
zstyle ':autocomplete:*complete*:*' insert-unambiguous yes
zstyle ':autocomplete:*history*:*' insert-unambiguous yes
zstyle ':autocomplete:menu-search:*' insert-unambiguous yes
bindkey '\t' menu-complete "$terminfo[kcbt]" reverse-menu-complete
#bindkey -M menuselect '\r' .accept-line

znap eval starship 'starship init zsh --print-full-init'
znap prompt

@ajmalab
Copy link

ajmalab commented Oct 27, 2023

@poopsicles I had the same issue when using Znap. I'd recommend removing Znap related code, and doing the manual install as follows:

  1. Run git clone https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete
    This will clone the repo into the default plugins folder for zsh
  2. Add zsh-autocomplete to plugins=(...) in your .zshrc file.
  3. Run source ~/.zshrc in your terminal and it should work as expected.

@poopsicles
Copy link
Author

@ajmalab cloning just the repo alone (without oh-my-zsh, znap, or any other managers) still loops for me

@aninder
Copy link

aninder commented Nov 6, 2023

have you tried changing the number of list-lines setting ,
zstyle ':autocomplete:history-search-backward:*' list-lines 256

@poopsicles
Copy link
Author

@aninder that seems to work in a way...it still loops if you go all the way to the 1st entry, but i guess 256 is better than 16

@aninder
Copy link

aninder commented Nov 11, 2023

it;s not perfect as it also clears the terminal and takes up all screen..

@yeoleobun
Copy link

It seems zsh autocomplete conflict with zsh auto suggestion, after remove zsh auto suggestion, it never happened.

@poopsicles
Copy link
Author

poopsicles commented Nov 28, 2023

@yeoleobun weird because removing the zstyle ':autocomplete:history-search-backward:*' list-lines 256 setting and commenting out zsh-autosuggestions still has the issue

@JerryZhongJ
Copy link

I have the same problem, I thought it was a feature🤣

@edte
Copy link

edte commented Jan 24, 2024

I also encountered the same problem when using zinit management plug-in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants