From 35270f7c97b955c733de17e1237a3b8c22735e55 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 23 Dec 2017 21:04:39 +0000 Subject: [PATCH] =?UTF-8?q?fixup!=20'main':=20Fix=20highlighting=20of=20?= =?UTF-8?q?=C2=AB<->=C2=BB-style=20numeric=20globs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- highlighters/main/main-highlighter.zsh | 4 ++-- highlighters/main/test-data/number_range-glob.zsh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index fcb1a48..53d7bb0 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -163,7 +163,7 @@ _zsh_highlight_main__is_redirection() { # - then, has a '<' or '>' character; # - is not a process substitution [<(...) or >(...)]. # - is not a numeric glob <-> - [[ $1 == (<0-9>|)(\<|\>)* ]] && [[ $1 != (\<|\>)$'\x28'* ]] && [[ $1 != '<'*'-'*'>' ]] + [[ $1 == (<0-9>|)(\<|\>)* ]] && [[ $1 != (\<|\>)$'\x28'* ]] && [[ $1 != *'<'*'-'*'>'* ]] } # Resolve alias. @@ -683,7 +683,7 @@ _zsh_highlight_highlighter_main_paint() ;; '`'*) style=back-quoted-argument;; [$][*]) style=default;; - [*?]*|*[^\\][*?]*|'<'*'-'*'>') + [*?]*|*[^\\][*?]*|*'<'*'-'*'>'*) $highlight_glob && style=globbing || style=default;; *) if false; then elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then diff --git a/highlighters/main/test-data/number_range-glob.zsh b/highlighters/main/test-data/number_range-glob.zsh index d885db1..c840e0d 100644 --- a/highlighters/main/test-data/number_range-glob.zsh +++ b/highlighters/main/test-data/number_range-glob.zsh @@ -28,9 +28,10 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -BUFFER=$'print <->' +BUFFER=$'print <-> 0<->' expected_region_highlight=( '1 5 builtin' # print '7 9 globbing' # <-> + '11 14 globbing' # 0<-> )