mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-11-04 03:56:30 +00:00 
			
		
		
		
	versionstamp: Handle NO_FUNCTION_ARGZERO.
Sourcing zsh-syntax-highlighting.zsh without FUNCTION_ARGZERO doesn't work (for
reasons unrelated to this branch), but now errors out gracefully.  The failure mode
before this branch was:
    zsh-syntax-highlighting: highlighters directory '/usr/local/bin/highlighters' not found.
where /usr/local/bin is dirname() of the zsh binary.
			
			
This commit is contained in:
		
							parent
							
								
									43386376d8
								
							
						
					
					
						commit
						9c56c624e9
					
				@ -29,7 +29,16 @@
 | 
			
		||||
# -------------------------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version)
 | 
			
		||||
if [[ -o function_argzero ]]; then
 | 
			
		||||
  # $0 is reliable
 | 
			
		||||
  ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version)
 | 
			
		||||
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 not it's not available in older zsh
 | 
			
		||||
  echo "zsh-syntax-highlighting: error: not compatible with FUNCTION_ARGZERO" >&2
 | 
			
		||||
  return 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# -------------------------------------------------------------------------------------------------
 | 
			
		||||
# Core highlighting update system
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user