Skip to content

Commit

Permalink
Fix sorin-ionescu#53: Prefix all defined functions with _zsh_highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoulaj committed Jul 26, 2011
1 parent 776453c commit 4ff08dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zsh-syntax-highlighting.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|orig-*|run-help|which-comman

# User defined widget: override and rebind old one with prefix "orig-".
user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
$cur_widget() { builtin zle orig-$cur_widget && _zsh_highlight }; \
zle -N $cur_widget";;
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget && _zsh_highlight }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;

# Completion widget: override and rebind old one with prefix "orig-".
completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
$cur_widget() { builtin zle orig-$cur_widget && _zsh_highlight }; \
zle -N $cur_widget";;
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget && _zsh_highlight }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;

# Builtin widget: override and make it call the builtin ".widget".
builtin) eval "$cur_widget() { builtin zle .$cur_widget && _zsh_highlight }; \
zle -N $cur_widget";;
builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget && _zsh_highlight }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;

# Default: unhandled case.
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
Expand Down

0 comments on commit 4ff08dc

Please sign in to comment.