11 Commits

Author SHA1 Message Date
Daniel Shahaf
023c994cdf 'main': Update comments after last commit. No functional change. 2020-01-12 18:16:31 +00:00
Daniel Shahaf
e5acdf0ba5 'main': Simplify alias handling.
$last_alias isn't needed; there's no reason to treat loops of length 2
(alias a=b b=a) differently to loops of length 1 (alias a=a), length 3
(alias a=b b=c c=a), or length N.

The «(( $+seen_alias[$arg] ))» check is redundant as of the last commit:
the enclosing condition ensures that $res is "alias", which implies that
«(( $+seen_alias[$arg] ))» is false.
2019-12-27 09:24:01 +00:00
Daniel Shahaf
44aa6f1f4e 'main': Fix issue #652. 2019-12-27 09:20:18 +00:00
Daniel Shahaf
ce10f20e77 'main': Add a regression test for #652. 2019-12-27 09:00:36 +00:00
Daniel Shahaf
6647e88606 'main': Add some precommands. 2019-12-25 10:53:42 +00:00
Matthew Martin
e7d3fbc50b main: Add test for previous 2019-11-07 19:59:00 -06:00
Matthew Martin
139ea2b189 main: Avoid $end_pos when calculating $arg size
Fixes second issue filed under #617
https://github.com/zsh-users/zsh-syntax-highlighting/issues/617#issuecomment-551253422

In the case of a command substitution in an alias, $arg[i,end_pos] would
not pass to the end of $arg and i <= start_pos - end_pos would not
iterate over all of $arg. Use $arg[i,-1] and $#arg respectively to avoid
issues in aliases.
2019-11-07 19:50:17 -06:00
Oliver Kiddle
be3882aeb0 driver: adjust region end for vi command mode 2019-10-17 21:18:56 +00:00
Daniel Shahaf
35c8690c00 release.md: Document that release tags should be signed.
That's how the previous tags were done.
2019-08-01 15:02:07 +00:00
Matthew Martin
b55832c5f8 main: Drop X_ from X_ZSH_HIGHLIGHT_DIRS_BLACKLIST 2019-07-24 07:27:54 -05:00
Daniel Shahaf
8e78e9dbba 'main': Fix issue #623 by fixing the expectations of the regression test of issue #616. 2019-07-21 01:44:19 +00:00
9 changed files with 168 additions and 42 deletions

View File

@@ -85,11 +85,11 @@ manual page][zshzle-Character-Highlighting].
#### Parameters #### Parameters
To avoid partial path lookups on a path, add the path to the `X_ZSH_HIGHLIGHT_DIRS_BLACKLIST` array. To avoid partial path lookups on a path, add the path to the `ZSH_HIGHLIGHT_DIRS_BLACKLIST` array.
This interface is still experimental. This interface is still experimental.
```zsh ```zsh
X_ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share) ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share)
``` ```
### Useless trivia ### Useless trivia

View File

@@ -311,12 +311,17 @@ _zsh_highlight_highlighter_main_paint()
'exec' a:cl 'exec' a:cl
'nocorrect' '' 'nocorrect' ''
'noglob' '' 'noglob' ''
'time' ''
'doas' aCu:Lns # as of OpenBSD's doas(1) dated September 4, 2016 'doas' aCu:Lns # as of OpenBSD's doas(1) dated September 4, 2016
'nice' n: # as of current POSIX spec 'nice' n: # as of current POSIX spec
'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags 'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags
'sudo' Cgprtu:AEHKPSVbhiklnsv # as of sudo 1.8.21p2 'sudo' Cgprtu:AEHKPSVbhiklnsv # as of sudo 1.8.21p2
'stdbuf' ioe: 'stdbuf' ioe:
'eatmydata' ''
'catchsegv' ''
'nohup' ''
'setsid' :wc
) )
if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then
@@ -355,6 +360,12 @@ _zsh_highlight_highlighter_main_paint()
'!' # reserved word; unrelated to $histchars[1] '!' # reserved word; unrelated to $histchars[1]
) )
if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then
print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.'
ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST)
unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST
fi
_zsh_highlight_main_highlighter_highlight_list -$#PREBUFFER '' 1 "$PREBUFFER$BUFFER" _zsh_highlight_main_highlighter_highlight_list -$#PREBUFFER '' 1 "$PREBUFFER$BUFFER"
# end is a reserved word # end is a reserved word
@@ -382,9 +393,7 @@ _zsh_highlight_main_highlighter_highlight_list()
# alias_style is the style to apply to an alias once in_alias=0 # alias_style is the style to apply to an alias once in_alias=0
# Usually 'alias' but set to 'unknown-token' if any word expanded from # Usually 'alias' but set to 'unknown-token' if any word expanded from
# the alias would be highlighted as unknown-token # the alias would be highlighted as unknown-token
# last_alias is the last alias arg (lhs) expanded (if in an alias). local alias_style arg buf=$4 highlight_glob=true style
# This allows for expanding alias ls='ls -l' while avoiding loops.
local alias_style arg buf=$4 highlight_glob=true last_alias style
local in_array_assignment=false # true between 'a=(' and the matching ')' local in_array_assignment=false # true between 'a=(' and the matching ')'
# in_alias is equal to the number of shifts needed until arg=args[1] pops an # in_alias is equal to the number of shifts needed until arg=args[1] pops an
# arg from BUFFER and not added by an alias. # arg from BUFFER and not added by an alias.
@@ -462,7 +471,7 @@ _zsh_highlight_main_highlighter_highlight_list()
if (( in_alias )); then if (( in_alias )); then
(( in_alias-- )) (( in_alias-- ))
if (( in_alias == 0 )); then if (( in_alias == 0 )); then
last_alias= seen_alias=() seen_alias=()
# start_pos and end_pos are of the alias (previous $arg) here # start_pos and end_pos are of the alias (previous $arg) here
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $alias_style _zsh_highlight_main_add_region_highlight $start_pos $end_pos $alias_style
fi fi
@@ -536,18 +545,17 @@ _zsh_highlight_main_highlighter_highlight_list()
if [[ $this_word == *:start:* ]] && ! (( in_redirection )); then if [[ $this_word == *:start:* ]] && ! (( in_redirection )); then
# Expand aliases. # Expand aliases.
_zsh_highlight_main__type "$arg" # An alias is ineligible for expansion while it's being expanded (see #652/#653).
_zsh_highlight_main__type "$arg" "$(( ! ${+seen_alias[$arg]} ))"
local res="$REPLY" local res="$REPLY"
if [[ $res == "alias" ]] && [[ $last_alias != $arg ]]; then if [[ $res == "alias" ]]; then
# Avoid looping forever on alias a=b b=c c=b, but allow alias foo='foo bar' # Mark insane aliases as unknown-token (cf. #263).
# Also mark insane aliases as unknown-token (cf. #263). if [[ $arg == ?*=* ]]; then
if (( $+seen_alias[$arg] )) || [[ $arg == ?*=* ]]; then
(( in_alias == 0 )) && in_alias=1 (( in_alias == 0 )) && in_alias=1
_zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token _zsh_highlight_main_add_region_highlight $start_pos $end_pos unknown-token
continue continue
fi fi
seen_alias[$arg]=1 seen_alias[$arg]=1
last_alias=$arg
_zsh_highlight_main__resolve_alias $arg _zsh_highlight_main__resolve_alias $arg
local -a alias_args local -a alias_args
# Elision is desired in case alias x='' # Elision is desired in case alias x=''
@@ -801,7 +809,7 @@ _zsh_highlight_main_highlighter_highlight_list()
# Discard :start_of_pipeline:, if present, as '!' is not valid # Discard :start_of_pipeline:, if present, as '!' is not valid
# after assignments. # after assignments.
next_word+=':start:' next_word+=':start:'
if (( start_pos + i <= end_pos )); then if (( i <= $#arg )); then
() { () {
local highlight_glob=false local highlight_glob=false
[[ $zsyh_user_options[globassign] == on ]] && highlight_glob=true [[ $zsyh_user_options[globassign] == on ]] && highlight_glob=true
@@ -966,7 +974,7 @@ _zsh_highlight_main_highlighter_check_path()
tmp_path=$tmp_path:a tmp_path=$tmp_path:a
while [[ $tmp_path != / ]]; do while [[ $tmp_path != / ]]; do
[[ -n ${(M)X_ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 [[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1
tmp_path=$tmp_path:h tmp_path=$tmp_path:h
done done
@@ -1024,7 +1032,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
'=') '=')
if [[ $arg[i+1] == $'\x28' ]]; then if [[ $arg[i+1] == $'\x28' ]]; then
(( i += 2 )) (( i += 2 ))
_zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,-1]
ret=$? ret=$?
(( i += REPLY )) (( i += REPLY ))
highlights+=( highlights+=(
@@ -1038,7 +1046,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
fi fi
esac esac
for (( ; i <= end_pos - start_pos ; i += 1 )); do for (( ; i <= $#arg ; i += 1 )); do
case "$arg[$i]" in case "$arg[$i]" in
"\\") (( i += 1 )); continue;; "\\") (( i += 1 )); continue;;
"'") "'")
@@ -1068,7 +1076,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
elif [[ $arg[i+1] == $'\x28' ]]; then elif [[ $arg[i+1] == $'\x28' ]]; then
start=$i start=$i
(( i += 2 )) (( i += 2 ))
_zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,-1]
ret=$? ret=$?
(( i += REPLY )) (( i += REPLY ))
highlights+=( highlights+=(
@@ -1091,7 +1099,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
if [[ $arg[i+1] == $'\x28' ]]; then # \x28 = open paren if [[ $arg[i+1] == $'\x28' ]]; then # \x28 = open paren
start=$i start=$i
(( i += 2 )) (( i += 2 ))
_zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,-1]
ret=$? ret=$?
(( i += REPLY )) (( i += REPLY ))
highlights+=( highlights+=(
@@ -1117,7 +1125,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
esac esac
done done
if (( path_eligible )) && _zsh_highlight_main_highlighter_check_path $arg[$1,end_pos]; then if (( path_eligible )) && _zsh_highlight_main_highlighter_check_path $arg[$1,-1]; then
base_style=$REPLY base_style=$REPLY
_zsh_highlight_main_highlighter_highlight_path_separators $base_style _zsh_highlight_main_highlighter_highlight_path_separators $base_style
highlights+=($reply) highlights+=($reply)
@@ -1169,7 +1177,7 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
local i j k ret style local i j k ret style
reply=() reply=()
for (( i = $1 + 1 ; i <= end_pos - start_pos ; i += 1 )) ; do for (( i = $1 + 1 ; i <= $#arg ; i += 1 )) ; do
(( j = i + start_pos - 1 )) (( j = i + start_pos - 1 ))
(( k = j + 1 )) (( k = j + 1 ))
case "$arg[$i]" in case "$arg[$i]" in
@@ -1200,7 +1208,7 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
breaks+=( $last_break $(( start_pos + i - 1 )) ) breaks+=( $last_break $(( start_pos + i - 1 )) )
(( i += 2 )) (( i += 2 ))
saved_reply=($reply) saved_reply=($reply)
_zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,-1]
ret=$? ret=$?
(( i += REPLY )) (( i += REPLY ))
last_break=$(( start_pos + i )) last_break=$(( start_pos + i ))
@@ -1266,13 +1274,13 @@ _zsh_highlight_main_highlighter_highlight_dollar_quote()
integer c integer c
reply=() reply=()
for (( i = $1 + 2 ; i <= end_pos - start_pos ; i += 1 )) ; do for (( i = $1 + 2 ; i <= $#arg ; i += 1 )) ; do
(( j = i + start_pos - 1 )) (( j = i + start_pos - 1 ))
(( k = j + 1 )) (( k = j + 1 ))
case "$arg[$i]" in case "$arg[$i]" in
"'") break;; "'") break;;
"\\") style=back-dollar-quoted-argument "\\") style=back-dollar-quoted-argument
for (( c = i + 1 ; c <= end_pos - start_pos ; c += 1 )); do for (( c = i + 1 ; c <= $#arg ; c += 1 )); do
[[ "$arg[$c]" != ([0-9xXuUa-fA-F]) ]] && break [[ "$arg[$c]" != ([0-9xXuUa-fA-F]) ]] && break
done done
AA=$arg[$i+1,$c-1] AA=$arg[$i+1,$c-1]
@@ -1327,7 +1335,7 @@ _zsh_highlight_main_highlighter_highlight_backtick()
last=$(( arg1 + 1 )) last=$(( arg1 + 1 ))
# Remove one layer of backslashes and find the end # Remove one layer of backslashes and find the end
while i=$arg[(ib:i+1:)[\\\\\`]]; do # find the next \ or ` while i=$arg[(ib:i+1:)[\\\\\`]]; do # find the next \ or `
if (( i > end_pos - start_pos )); then if (( i > $#arg )); then
buf=$buf$arg[last,i] buf=$buf$arg[last,i]
offsets[i-arg1-offset]='' # So we never index past the end offsets[i-arg1-offset]='' # So we never index past the end
(( i-- )) (( i-- ))
@@ -1411,4 +1419,4 @@ else
# Make sure the cache is unset # Make sure the cache is unset
unset _zsh_highlight_main__command_type_cache unset _zsh_highlight_main__command_type_cache
fi fi
typeset -ga X_ZSH_HIGHLIGHT_DIRS_BLACKLIST typeset -ga ZSH_HIGHLIGHT_DIRS_BLACKLIST

View File

@@ -0,0 +1,37 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2019 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Alias must be at least 4 characters to test the regression
# cf. 139ea2b189819c43cc251825981c116959b15cc3
alias foobar='echo "$(echo foobar)"'
BUFFER='foobar'
expected_region_highlight=(
"1 6 alias" # foobar
)

View File

@@ -0,0 +1,36 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2019 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
alias ls='command ls'
BUFFER='ls'
expected_region_highlight=(
"1 2 alias" # ls
)

View File

@@ -0,0 +1,36 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2019 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
alias ls=tmp tmp='command ls'
BUFFER='ls'
expected_region_highlight=(
"1 2 alias" # ls
)

View File

@@ -30,7 +30,7 @@
mkdir foo mkdir foo
touch foo/bar touch foo/bar
BUFFER=": foo/bar $PWD/foo foo/b" BUFFER=": foo/bar $PWD/foo foo/b"
X_ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo $PWD/bar) ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo $PWD/bar)
expected_region_highlight=( expected_region_highlight=(
'1 1 builtin' # : '1 1 builtin' # :

View File

@@ -28,10 +28,12 @@
# vim: ft=zsh sw=2 ts=2 et # vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
BUFFER=$':;\n' # Newline after semicolon isn't unknown-token
BUFFER=$':;\n:'
expected_region_highlight=( expected_region_highlight=(
'1 1 builtin' # : '1 1 builtin' # :
'2 2 commandseparator' # ; '2 2 commandseparator' # ;
'3 3 issue-623 "issue #616"' # \n '3 3 commandseparator "issue #616"' # \n
'4 4 builtin' # :
) )

View File

@@ -9,7 +9,7 @@
`tig --abbrev=12 --abbrev-commit 0.4.1..upstream/master` `tig --abbrev=12 --abbrev-commit 0.4.1..upstream/master`
- Remove `-dev` suffix from `./.version`; - Remove `-dev` suffix from `./.version`;
Commit that using `git commit -m "Tag version $(<.version)." .version`; Commit that using `git commit -m "Tag version $(<.version)." .version`;
Tag it using `git tag -m "Tag version $(<.version)"`; Tag it using `git tag -s -m "Tag version $(<.version)"`;
Increment `./.version` and restore the `-dev` suffix; Increment `./.version` and restore the `-dev` suffix;
Commit that using `git commit -C b5c30ae52638e81a38fe5329081c5613d7bd6ca5 .version`. Commit that using `git commit -C b5c30ae52638e81a38fe5329081c5613d7bd6ca5 .version`.
- Push with `git push && git push --tags` - Push with `git push && git push --tags`

View File

@@ -157,24 +157,25 @@ _zsh_highlight()
# Re-apply zle_highlight settings # Re-apply zle_highlight settings
# region # region
if (( REGION_ACTIVE == 1 )); then
_zsh_highlight_apply_zle_highlight region standout "$MARK" "$CURSOR"
elif (( REGION_ACTIVE == 2 )); then
() { () {
local needle=$'\n' (( REGION_ACTIVE )) || return
integer min max integer min max
if (( MARK > CURSOR )) ; then if (( MARK > CURSOR )) ; then
min=$CURSOR max=$MARK min=$CURSOR max=$MARK
else else
min=$MARK max=$CURSOR min=$MARK max=$CURSOR
fi fi
if (( REGION_ACTIVE == 1 )); then
[[ $KEYMAP = vicmd ]] && (( max++ ))
elif (( REGION_ACTIVE == 2 )); then
local needle=$'\n'
# CURSOR and MARK are 0 indexed between letters like region_highlight # CURSOR and MARK are 0 indexed between letters like region_highlight
# Do not include the newline in the highlight # Do not include the newline in the highlight
(( min = ${BUFFER[(Ib:min:)$needle]} )) (( min = ${BUFFER[(Ib:min:)$needle]} ))
(( max = ${BUFFER[(ib:max:)$needle]} - 1 )) (( max = ${BUFFER[(ib:max:)$needle]} - 1 ))
fi
_zsh_highlight_apply_zle_highlight region standout "$min" "$max" _zsh_highlight_apply_zle_highlight region standout "$min" "$max"
} }
fi
# yank / paste (zsh-5.1.1 and newer) # yank / paste (zsh-5.1.1 and newer)
(( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END" (( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END"
@@ -432,6 +433,12 @@ zmodload zsh/parameter 2>/dev/null || true
# Initialize the array of active highlighters if needed. # Initialize the array of active highlighters if needed.
[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) [[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then
print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.'
ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST)
unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST
fi
# Restore the aliases we unned # Restore the aliases we unned
eval "$zsh_highlight__aliases" eval "$zsh_highlight__aliases"
builtin unset zsh_highlight__aliases builtin unset zsh_highlight__aliases