driver: Fix a bug that prevented subsequent, third-party zle-line-pre-redraw hooks from running.
Without this patch, `_zsh_highlight` was invoked by add-zle-hook-widget with `$?` being non-zero (see add-zle-hook-widget:48-52). Since `_zsh_highlight` preserves `$?` from its caller's point of view, add-zle-hook-widget saw a non-zero exit code from `_zsh_highlight` and did not run any the remaining zle-line-pre-redraw hooks. See https://github.com/zsh-users/zsh-syntax-highlighting/issues/579#issuecomment-623576907.
This commit is contained in:
		
							parent
							
								
									8d4c6355e6
								
							
						
					
					
						commit
						b08d508cd8
					
				|  | @ -350,9 +350,15 @@ then | ||||||
|       _zsh_highlight |       _zsh_highlight | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   _zsh_highlight__zle-line-pre-redraw() { | ||||||
|  |     # Set $? to 0 for _zsh_highlight.  Without this, subsequent | ||||||
|  |     # zle-line-pre-redraw hooks won't run, since add-zle-hook-widget happens to | ||||||
|  |     # call us with $? == 1 in the common case. | ||||||
|  |     true && _zsh_highlight "$@" | ||||||
|  |   } | ||||||
|   _zsh_highlight_bind_widgets(){} |   _zsh_highlight_bind_widgets(){} | ||||||
|   if [[ -o zle ]]; then |   if [[ -o zle ]]; then | ||||||
|     add-zle-hook-widget zle-line-pre-redraw _zsh_highlight |     add-zle-hook-widget zle-line-pre-redraw _zsh_highlight__zle-line-pre-redraw | ||||||
|     add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish |     add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish | ||||||
|   fi |   fi | ||||||
| else | else | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue