Compare commits

...

3 Commits

Author SHA1 Message Date
Roman Perepelitsa 5f18ac892e
Merge 585696eeeb into 2fc57d6306 2026-08-22 09:20:14 +07:00
Manish Tiwari 2fc57d6306 tests: fix relative links in tests/README.md
test-highlighting.zsh and test-perfs.zsh were linked as tests/test-*.zsh,
but this file already lives in tests/, so the links resolved to
tests/tests/test-*.zsh and 404'd. Found by pointing a markdown
link-checker at the repo.
2026-08-21 21:19:05 -05: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
2 changed files with 11 additions and 7 deletions

View File

@ -1236,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
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

View File

@ -86,7 +86,7 @@ grow ways to set `$PREBUFFER` to inject free-form code into the generated file.
Highlighting test Highlighting test
----------------- -----------------
[`test-highlighting.zsh`](tests/test-highlighting.zsh) tests the correctness of [`test-highlighting.zsh`](test-highlighting.zsh) tests the correctness of
the highlighting. Usage: the highlighting. Usage:
```zsh ```zsh
@ -110,7 +110,7 @@ results (tests that failed but were expected to succeed, or vice-versa), run
Performance test Performance test
---------------- ----------------
[`test-perfs.zsh`](tests/test-perfs.zsh) measures the time spent doing the [`test-perfs.zsh`](test-perfs.zsh) measures the time spent doing the
highlighting. Usage: highlighting. Usage:
```zsh ```zsh