Compare commits

...

3 Commits

Author SHA1 Message Date
Roman Perepelitsa a524354983
Merge 585696eeeb into c4d9559184 2026-08-11 19:20:13 +07:00
Colin Kinloch c4d9559184 main: Add systemd run0 equivalent to sudo 2026-08-07 12:11:51 -07: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

@ -354,6 +354,7 @@ _zsh_highlight_highlighter_main_paint()
'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
# Not listed: -h, which has two different meanings. # Not listed: -h, which has two different meanings.
'sudo' Cgprtu:AEHPSbilns:eKkVv # as of sudo 1.8.21p2 'sudo' Cgprtu:AEHPSbilns:eKkVv # as of sudo 1.8.21p2
'run0' ugD:h # systemd 256.6
'stdbuf' ioe: 'stdbuf' ioe:
'eatmydata' '' 'eatmydata' ''
'catchsegv' '' 'catchsegv' ''
@ -1235,14 +1236,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
if [[ $tmp_path == /* ]]; then
while [[ $tmp_path != / ]]; do while [[ $tmp_path != / ]]; do
[[ -n ${(M)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
fi
if (( in_command_position )); then if (( in_command_position )); then
if [[ -x $expanded_path ]]; then if [[ -x $expanded_path ]]; then