driver: Stop requiring function_argzero.
Instead, use the %N prompt expando, as suggested by Bart in users/21637. Avoid the `print -P %N` syntax to save a fork on Cygwin, at the expense of not supporting zsh's from 2001 through c. 2004 vintages. Fixes #338.
This commit is contained in:
		
							parent
							
								
									d9e07b5082
								
							
						
					
					
						commit
						750aebc553
					
				|  | @ -1 +1,2 @@ | ||||||
|  | 0=${(%):-%N} | ||||||
| source ${0:A:h}/zsh-syntax-highlighting.zsh | source ${0:A:h}/zsh-syntax-highlighting.zsh | ||||||
|  |  | ||||||
|  | @ -28,7 +28,9 @@ | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if [[ -o function_argzero ]]; then | # Set $0 to the expected value, regardless of functionargzero. | ||||||
|  | 0=${(%):-%N} | ||||||
|  | if true; then | ||||||
|   # $0 is reliable |   # $0 is reliable | ||||||
|   ZSH_HIGHLIGHT_VERSION=$(<"${0:A:h}"/.version) |   ZSH_HIGHLIGHT_VERSION=$(<"${0:A:h}"/.version) | ||||||
|   ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash) |   ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash) | ||||||
|  | @ -38,12 +40,6 @@ if [[ -o function_argzero ]]; then | ||||||
|     # the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so: |     # the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so: | ||||||
|     ZSH_HIGHLIGHT_REVISION=HEAD |     ZSH_HIGHLIGHT_REVISION=HEAD | ||||||
|   fi |   fi | ||||||
| else |  | ||||||
|   # $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail. |  | ||||||
|   # TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute? |  | ||||||
|   # TODO: also check POSIX_ARGZERO, but note it's not available in older zsh |  | ||||||
|   echo "zsh-syntax-highlighting: error: not compatible with NO_FUNCTION_ARGZERO" >&2 |  | ||||||
|   return 1 |  | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue