Skip to content

Commit 59cb9a5

Browse files
committed
driver: Make the redrawhook codepath conditional upon the memo= feature.
Fixes #579 (zsh-autosuggestions interoperability). Fixes #735 (ditto). See #579 (comment) See zsh-users/zsh-autosuggestions#529 (comment)
1 parent 7b863fb commit 59cb9a5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

zsh-syntax-highlighting.zsh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,17 @@ _zsh_highlight_call_widget()
403403
_zsh_highlight
404404
}
405405

406-
if _zsh_highlight__function_callable_p add-zle-hook-widget
406+
# Decide whether to use the zle-line-pre-redraw codepath (colloquially known as
407+
# "feature/redrawhook", after the topic branch's name) or the legacy "bind all
408+
# widgets" codepath.
409+
#
410+
# We use the new codepath under two conditions:
411+
#
412+
# 1. If it's available, which we check by testing for add-zle-hook-widget's availability.
413+
#
414+
# 2. If zsh has the memo= feature, which is required for interoperability reasons.
415+
# See issues #579 and #735, and the issues referenced from them.
416+
if (( zsh_highlight__memo_feature )) && _zsh_highlight__function_callable_p add-zle-hook-widget
407417
then
408418
autoload -U add-zle-hook-widget
409419
_zsh_highlight__zle-line-finish() {

0 commit comments

Comments
 (0)