From ed33d2cb13884b298a996ceadfc94ae6ffd78825 Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sat, 2 Jan 2016 14:28:56 +0100 Subject: [PATCH 1/2] widget binding: don't exclude widgets starting with '_' Just because a widget starts with _ does not mean it should be skipped when rebinding. The only reason widgets need to be skipped is when their function name start with _zsh_highlight_widget*, which is checked later. Example: _expand_alias (^Xa) needs to be wrapped. The exclusion of _* was introduced in 186d80054a40262b9db967aeaf483a28027de19f to fix #65, but it is not needed. The relevant exclusion of _zsh_highlight_widget* is already enough due to the case statement. --- zsh-syntax-highlighting.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 3e243d2..6b27722 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -200,7 +200,7 @@ _zsh_highlight_bind_widgets() # Override ZLE widgets to make them invoke _zsh_highlight. local cur_widget - for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|set-local-history|yank)}; do + for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|orig-*|run-help|which-command|beep|set-local-history|yank)}; do case $widgets[$cur_widget] in # Already rebound event: do nothing. From 487b122c480d00befc3f80a8cc2e53ad99593b2c Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sat, 2 Jan 2016 14:31:35 +0100 Subject: [PATCH 2/2] widget binding: don't exclude widgets with identical function name Skipping when $cur_widgets == user:$cur_widget was introduced with 776453cb5b6922a61c01fb51f1c0bdbaf73b79d3. However there are cases where this is not just an 'already rebound' event, but simply a normal widget whose function name happens to be identical to its widget name. Example: expand-absolute-path is a widget whose function name is also expand-absolute-path. No reason why this should be ignored. Another example: edit-command-line --- zsh-syntax-highlighting.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 6b27722..540d8e5 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -204,7 +204,7 @@ _zsh_highlight_bind_widgets() case $widgets[$cur_widget] in # Already rebound event: do nothing. - user:$cur_widget|user:_zsh_highlight_widget_*);; + user:_zsh_highlight_widget_*);; # User defined widget: override and rebind old one with prefix "orig-". user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \