zsh-autocomplete icon indicating copy to clipboard operation
zsh-autocomplete copied to clipboard

Bug with zsh-syntax-highlighting: unhandled ZLE widget

Open ForsakenRei opened this issue 3 months ago • 3 comments

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace

typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace typeset VENDOR=redhat typeset OSTYPE=linux-gnu typeset ZSH_PATCHLEVEL=zsh-5.8-0-g77d203f typeset -a _autocomplete__funcfiletrace=( /home/shigure/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4 .zshrc:44 zsh:1 )

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

d408d90 (HEAD) Remove erroneous break statement

This is a working commit from Mar 25th I'm using on a different system, tried latest head 1968100 and another commit b62154d but the problem persists.

  • Operating system: Oracle Linux 9.3
  • Terminal emulator: Windows terminal

Steps to reproduce

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
git clone https://github.com/marlonrichert/zsh-autocomplete.git ~/.zsh/zsh-autocomplete
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting

Content of my .zshrc, just kept those 3 lines to isolate the issue while I'm testing.

# zsh plugins
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

After source, output

zsh-syntax-highlighting: unhandled ZLE widget 'insert-unambiguous-or-complete' zsh-syntax-highlighting: (This is sometimes caused by doing bindkey <keys> insert-unambiguous-or-complete without creating the 'insert-unambiguous-or-complete' widget with zle -N or zle -C.) zsh-syntax-highlighting: unhandled ZLE widget 'menu-search' zsh-syntax-highlighting: (This is sometimes caused by doing bindkey <keys> menu-search without creating the 'menu-search' widget with zle -N or zle -C.) zsh-syntax-highlighting: unhandled ZLE widget 'recent-paths' zsh-syntax-highlighting: (This is sometimes caused by doing bindkey <keys> recent-paths without creating the 'recent-paths' widget with zle -N or zle -C.)

originally I thought it's syntax highlighting but checking with

echo $widgets[insert-unambiguous-or-complete]
echo $widgets[recent-paths]
echo $widgets[menu-search]

I got those output

completion:complete-word:.autocomplete__complete-word__completion-widget user:.autocomplete:async:toggle-context completion:menu-select:.autocomplete__complete-word__completion-widget

If I remove auto-complete then everything works fine.

Contents of ~autocomplete-log/YYYY-MM-DD.log (click to expand)

ForsakenRei avatar Apr 04 '24 23:04 ForsakenRei

Same issue here. Also thought it was syntax-highlighting as that's the error output, but went through my list of plugins turning them off one by one and it stopped when autocomplete was turned off but syntax-highlighting was still on.

Nathanjp91 avatar Apr 05 '24 23:04 Nathanjp91

zsh-syntax-highlighting: unhandled ZLE widget 'menu-search'
zsh-syntax-highlighting: unhandled ZLE widget 'insert-unambiguous-or-complete'
zsh-syntax-highlighting: unhandled ZLE widget 'recent-paths'
# ------------ log
_complete:6: command not found: _autocomplete__recent_paths
_complete:7: command not found: _autocomplete__ancestor_dirs
autocomplete:_main_complete:new:post:3: command not found: _autocomplete__unambiguous
autocomplete:_main_complete:new:post:3: command not found: _autocomplete__unambiguous

If you dont like popup them, you can commit 3 line, The world is quiet now.

# zsh-autocomplete/Functions/Init/.autocomplete__key-bindings
#line 49-50:
#"$backtab" insert-unambiguous-or-complete
#'^X/' recent-paths
#line 57:
#${0}:bind                         menu-search history-incremental-search-forward  '^S' '?'

Angluca avatar Apr 09 '24 21:04 Angluca

I'm having the same issue.

I've narrowed it down to commit 545051e44407ac42215495d283c37cea9f8be362.

Before this commit, the functions rebind() and bound() were being called for 'menu-search', etc., and the call to bound() would return false preventing the bindkey command in rebind() from executing.

After this commit, the bindkey command is executed for all the bindings without any check. For some reason this then causes zsh-syntax-highlighting to complain about these bindings.

moutazhaq avatar Apr 11 '24 02:04 moutazhaq