Compare commits

...

3 Commits

Author SHA1 Message Date
Roman Perepelitsa b5efe9ff99
Merge 585696eeeb into 1d85c69261 2026-02-10 21:33:38 +05:30
Matthew Martin 1d85c69261 main: precommand_options += caffeinate
Closes #975
2026-02-08 10:49:40 -06:00
Roman Perepelitsa 585696eeeb bug fix: infinite loop when cwd doesn't exist
To reproduce:

    % mkdir /tmp/foo
    % cd /tmp/foo
    % rmdir /tmp/foo
    % exec zsh -f
    % source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Press 'a' and zle will hang.
2020-07-19 11:03:10 +02:00
1 changed files with 10 additions and 5 deletions

View File

@ -372,6 +372,7 @@ _zsh_highlight_highlighter_main_paint()
'grc' :se # grc - a "generic colouriser" (that's their spelling, not mine) 'grc' :se # grc - a "generic colouriser" (that's their spelling, not mine)
'cpulimit' elp:ivz # cpulimit 0.2 'cpulimit' elp:ivz # cpulimit 0.2
'ktrace' fgpt:aBCcdiT 'ktrace' fgpt:aBCcdiT
'caffeinate' tw:dimsu # as of macOS's caffeinate(8) dated November 9, 2012
) )
# Commands that would need to skip one positional argument: # Commands that would need to skip one positional argument:
# flock # flock
@ -1234,14 +1235,18 @@ _zsh_highlight_main_highlighter_check_path()
if [[ $expanded_path[1] == / ]]; then if [[ $expanded_path[1] == / ]]; then
tmp_path=$expanded_path tmp_path=$expanded_path
else else
tmp_path=$PWD/$expanded_path # Unlike $PWD, ${(%):-%/} predictably expands to '.' if the current
# working directory doesn't exist.
tmp_path=${(%):-%/}/$expanded_path
fi fi
tmp_path=$tmp_path:a tmp_path=$tmp_path:a
while [[ $tmp_path != / ]]; do if [[ $tmp_path == /* ]]; then
[[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 while [[ $tmp_path != / ]]; do
tmp_path=$tmp_path:h [[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1
done tmp_path=$tmp_path:h
done
fi
if (( in_command_position )); then if (( in_command_position )); then
if [[ -x $expanded_path ]]; then if [[ -x $expanded_path ]]; then