'main': Restore support for zsh-4.3.10 and older.
zsh older than workers/28418 (zsh revision 23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95)
doesn't support the «${name:offset:length}» syntax.  Therefore, use the older
«$name[start,end]» syntax instead.
Followup to 3cb58fd7d7, "Optimization: -1 is
extra computation of string length internally".
Fixes zsh-users/zsh-syntax-highlighting#279.
			
			
This commit is contained in:
		
							parent
							
								
									cb02451a4e
								
							
						
					
					
						commit
						bc7f8ea433
					
				|  | @ -235,13 +235,11 @@ _zsh_highlight_main_highlighter() | |||
|       # indistinguishable from 'echo foo echo bar' (one command with three | ||||
|       # words for arguments). | ||||
|       local needle=$'[;\n]' | ||||
|       # Len-start_pos drops one character, but it should do it, as start_pos | ||||
|       # starts from next, not from "start_pos", character | ||||
|       integer offset=${${buf: start_pos: len-start_pos}[(i)$needle]} | ||||
|       integer offset=${${buf[start_pos+1,len]}[(i)$needle]} | ||||
|       (( start_pos += offset - 1 )) | ||||
|       (( end_pos = start_pos + $#arg )) | ||||
|     else | ||||
|       ((start_pos+=(len-start_pos)-${#${${buf: start_pos: len-start_pos}##([[:space:]]|\\[[:space:]])#}})) | ||||
|       ((start_pos+=(len-start_pos)-${#${${buf[start_pos+1,len]}##([[:space:]]|\\[[:space:]])#}})) | ||||
|       ((end_pos=$start_pos+${#arg})) | ||||
|     fi | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue