Skip to content

Wrapped ZLE widgets are not dumped by compdump #851

Open
@ericbn

Description

@ericbn

Describe the bug
The ZLE widgets dumped by compinit (before sourcing zsh-syntax-highlighting) are not dumped in a subsequent compdump (after sourcing zsh-syntax-highlighting) because they have been wrapped by zsh-syntax-highlighting.

How to reproduce

❯ docker run -it --rm zshusers/zsh:5.8
# apt update && apt install -y git
...
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting
...
# > ~/.zshrc <<\END
autoload -Uz compinit && compinit -C
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
END
# exec zsh
# cp ~/.zcompdump{,.old}
# compdump
# diff ~/.zcompdump{.old,}

Current output

1764,1793d1763
< zle -C _bash_complete-word .complete-word _bash_completions
< zle -C _bash_list-choices .list-choices _bash_completions
< zle -C _complete_debug .complete-word _complete_debug
< zle -C _complete_help .complete-word _complete_help
< zle -C _complete_tag .complete-word _complete_tag
< zle -C _correct_filename .complete-word _correct_filename
< zle -C _correct_word .complete-word _correct_word
< zle -C _expand_alias .complete-word _expand_alias
< zle -C _expand_word .complete-word _expand_word
< zle -C _history-complete-newer .complete-word _history_complete_word
< zle -C _history-complete-older .complete-word _history_complete_word
< zle -C _list_expansions .list-choices _expand_word
< zle -C _most_recent_file .complete-word _most_recent_file
< zle -C _next_tags .list-choices _next_tags
< zle -C _read_comp .complete-word _read_comp
< bindkey '^X^R' _read_comp
< bindkey '^X?' _complete_debug
< bindkey '^XC' _correct_filename
< bindkey '^Xa' _expand_alias
< bindkey '^Xc' _correct_word
< bindkey '^Xd' _list_expansions
< bindkey '^Xe' _expand_word
< bindkey '^Xh' _complete_help
< bindkey '^Xm' _most_recent_file
< bindkey '^Xn' _next_tags
< bindkey '^Xt' _complete_tag
< bindkey '^X~' _bash_list-choices
< bindkey '^[,' _history-complete-newer
< bindkey '^[/' _history-complete-older
< bindkey '^[~' _bash_complete-word

Expected output
There should be no output from diff.

Additional context
Without sourcing zsh-syntax-highlighting, I get:

# zle -lL | grep _bash_completions
zle -C _bash_complete-word .complete-word _bash_completions
zle -C _bash_list-choices .list-choices _bash_completions

After sourcing zsh-syntax-highlighting, I get:

# zle -lL | grep _bash_completions
zle -C orig-s0.0000110000-r12616-_bash_complete-word .complete-word _bash_completions
zle -C orig-s0.0000110000-r12616-_bash_list-choices .list-choices _bash_completions

And compdump will dump all widgets from zle -lL that march _* in the 3rd and 5th words in the list above.

Maybe a solution is to prepend a _ to the ZLE widget wrapper name when the original name also starts with _?

EDIT: Or letting compdump use the wrapper names will actually not work at all! In this case, the solution could be to not wrap widgets with names and respective function names both starting with _...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions