mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-04-17 11:35:32 +08:00
WIP: Snapshot that *almost* passes tests, but may or may not be correct.
Current test failures: Running test main # parameter-value-contains-command-position1 1..2 ok 1 - [1,7] «$foobar» not ok 2 - have 1 expectations and 2 region_highlight entries: «expected_region_highlight=( '1 7 assign' )» «region_highlight=( '0 7 assign' '0 7 assign' )» # parameter-value-contains-command-position2 1..2 ok 1 - [1,2] «$y» not ok 2 - have 1 expectations and 2 region_highlight entries: «expected_region_highlight=( '1 2 assign' )» «region_highlight=( '0 2 assign' '0 2 assign' )»
This commit is contained in:
parent
2d0f51b54e
commit
bc3b94349d
@ -78,8 +78,13 @@ _zsh_highlight_main_add_region_highlight() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if (( in_param )); then
|
if (( in_param )); then
|
||||||
[[ $1 == unknown-token ]] && param_style=unknown-token
|
if [[ $1 == unknown-token ]]; then
|
||||||
return
|
param_style=unknown-token
|
||||||
|
fi
|
||||||
|
if [[ -n $param_style ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
param_style=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The calculation was relative to $buf but region_highlight is relative to $BUFFER.
|
# The calculation was relative to $buf but region_highlight is relative to $BUFFER.
|
||||||
@ -963,8 +968,9 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
fi
|
fi
|
||||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
|
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
|
||||||
done
|
done
|
||||||
|
: ${param_style:=$style}
|
||||||
(( in_alias == 1 )) && in_alias=0 _zsh_highlight_main_add_region_highlight $start_pos $end_pos $alias_style
|
(( in_alias == 1 )) && in_alias=0 _zsh_highlight_main_add_region_highlight $start_pos $end_pos $alias_style
|
||||||
(( in_param == 1 )) && in_param=0 _zsh_highlight_main_add_region_highlight $start_pos $end_pos ${param_style:-"unknown-token"}
|
(( in_param == 1 )) && in_param=0 _zsh_highlight_main_add_region_highlight $start_pos $end_pos $param_style
|
||||||
[[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\$'\n')#) ]]
|
[[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\$'\n')#) ]]
|
||||||
REPLY=$(( end_pos + ${#match[1]} - 1 ))
|
REPLY=$(( end_pos + ${#match[1]} - 1 ))
|
||||||
reply=($list_highlights)
|
reply=($list_highlights)
|
||||||
|
Loading…
Reference in New Issue
Block a user