mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-23 15:46:27 +08:00 
			
		
		
		
	'main': Allow newlines in command position.
Fixes #501. Fixes #616 (the original form; not the form in test-data/alias-comment1.zsh which is now considered o be #677 (see previous commit for details)). Fixes a latent bug in test-data/always2.zsh. No user-visible effect, and therefore, no changelog entry.
This commit is contained in:
		
							parent
							
								
									e94dc89606
								
							
						
					
					
						commit
						9134cdf8d6
					
				| @ -747,10 +747,12 @@ _zsh_highlight_main_highlighter_highlight_list() | |||||||
|          (*) style=unknown-token;; |          (*) style=unknown-token;; | ||||||
|        esac |        esac | ||||||
|      elif [[ $this_word == *':regular:'* ]]; then |      elif [[ $this_word == *':regular:'* ]]; then | ||||||
|        # This highlights empty commands (semicolon follows nothing) as an error. |        style=commandseparator | ||||||
|        # Zsh accepts them, though. |      elif [[ $this_word == *':start:'* ]] && [[ $arg == $'\n' ]]; then | ||||||
|        style=commandseparator |        style=commandseparator | ||||||
|      else |      else | ||||||
|  |        # This highlights empty commands (semicolon follows nothing) as an error. | ||||||
|  |        # Zsh accepts them, though. | ||||||
|        style=unknown-token |        style=unknown-token | ||||||
|      fi |      fi | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ BUFFER=$'{\nls\n} always { pwd }' | |||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|   '1 1 reserved-word' # { |   '1 1 reserved-word' # { | ||||||
|   '2 2 unknown-token' # \n |   '2 2 commandseparator' # \n | ||||||
|   '3 4 command' # ls |   '3 4 command' # ls | ||||||
|   '5 5 commandseparator' # \n |   '5 5 commandseparator' # \n | ||||||
|   '6 6 reserved-word' # } |   '6 6 reserved-word' # } | ||||||
|  | |||||||
| @ -34,6 +34,6 @@ BUFFER=$'# foo\ntrue' | |||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|   '1 5 comment' # # foo |   '1 5 comment' # # foo | ||||||
|   '6 6 commandseparator "issue #501"' # \n |   '6 6 commandseparator' # \n | ||||||
|   '7 10 builtin' # true |   '7 10 builtin' # true | ||||||
| ) | ) | ||||||
|  | |||||||
| @ -34,6 +34,6 @@ BUFFER=$':;\n:' | |||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|   '1 1 builtin' # : |   '1 1 builtin' # : | ||||||
|   '2 2 commandseparator' # ; |   '2 2 commandseparator' # ; | ||||||
|   '3 3 commandseparator "issue #616"' # \n |   '3 3 commandseparator' # \n | ||||||
|   '4 4 builtin' # : |   '4 4 builtin' # : | ||||||
| ) | ) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Shahaf
						Daniel Shahaf