'main': Fix issue #677, concerning multiline aliases.
The fix is to exempt such aliases from the empty commands sanity check.
This commit is contained in:
parent
8211a95421
commit
ade4b28d2d
@ -85,6 +85,10 @@
|
|||||||
`_zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook`
|
`_zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook`
|
||||||
[#727, #731, #732, #733]
|
[#727, #731, #732, #733]
|
||||||
|
|
||||||
|
- Fix highlighting of alias whose definitions use a simple command terminator
|
||||||
|
(such as `;`, `|`, `&&`) before a newline
|
||||||
|
[#677; had regressed in 0.7.0]
|
||||||
|
|
||||||
# Changes in version 0.7.1
|
# Changes in version 0.7.1
|
||||||
|
|
||||||
- Remove out-of-date information from the 0.7.0 changelog.
|
- Remove out-of-date information from the 0.7.0 changelog.
|
||||||
@ -159,6 +163,7 @@ Known issues include:
|
|||||||
before a newline will incorrectly be highlighted as an error. See issue #677
|
before a newline will incorrectly be highlighted as an error. See issue #677
|
||||||
for examples and workarounds.
|
for examples and workarounds.
|
||||||
[#677]
|
[#677]
|
||||||
|
[UPDATE: Fixed in 0.8.0]
|
||||||
|
|
||||||
|
|
||||||
# Changes in version 0.6.0
|
# Changes in version 0.6.0
|
||||||
|
@ -854,9 +854,17 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
style=commandseparator
|
style=commandseparator
|
||||||
elif [[ $this_word == *':start:'* ]] && [[ $arg == $'\n' ]]; then
|
elif [[ $this_word == *':start:'* ]] && [[ $arg == $'\n' ]]; then
|
||||||
style=commandseparator
|
style=commandseparator
|
||||||
|
elif [[ $this_word == *':start:'* ]] && [[ $arg == ';' ]] && (( in_alias )); then
|
||||||
|
style=commandseparator
|
||||||
else
|
else
|
||||||
# This highlights empty commands (semicolon follows nothing) as an error.
|
# Empty commands (semicolon follows nothing) are valid syntax.
|
||||||
# Zsh accepts them, though.
|
# However, in interactive use they are likely to be erroneous;
|
||||||
|
# therefore, we highlight them as errors.
|
||||||
|
#
|
||||||
|
# Alias definitions are exempted from this check to allow multiline aliases
|
||||||
|
# with explicit (redundant) semicolons: «alias foo=$'bar;\nbaz'» (issue #677).
|
||||||
|
#
|
||||||
|
# See also #691 about possibly changing the style used here.
|
||||||
style=unknown-token
|
style=unknown-token
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -33,5 +33,5 @@ alias x=$'# foo\npwd'
|
|||||||
BUFFER='x'
|
BUFFER='x'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
'1 1 alias "issue #677"' # x
|
'1 1 alias' # x
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user