diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Completion/Unix/Type/_ssh_hosts | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 39efef8eb..fcebf9b4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2021-10-26 Oliver Kiddle <opk@zsh.org> + * Peter Palfrader: 49431 (tweaked, c.f. Bart: 49434): + Completion/Unix/Type/_ssh_hosts: Faster ~/.ssh/config processing + * Marlon: 49521: Doc/Zsh/compwid.yo, Test/Y02compmatch.ztst: Define correct behavior of || completion matchers diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts index bd5366425..a4a08ad91 100644 --- a/Completion/Unix/Type/_ssh_hosts +++ b/Completion/Unix/Type/_ssh_hosts @@ -20,8 +20,9 @@ if [[ -r $config ]]; then local key line host local -a lines=("${(@f)$(<"$config")}") 2>/dev/null local -a match_args - while (($#lines)); do - IFS=$'=\t ' read -r key line <<<"${lines[1]}" + local idx=1 + while (( idx <= $#lines )); do + IFS=$'=\t ' read -r key line <<<"${lines[idx]}" if [[ "$key" == ((#i)match) ]]; then match_args=(${(z)line}) while [[ $#match_args -ge 2 ]]; do @@ -35,7 +36,7 @@ if [[ -r $config ]]; then fi case "$key" in ((#i)include) - lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; + lines[idx]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; ((#i)host(|name)) for host in ${(z)line}; do case $host in @@ -43,7 +44,7 @@ if [[ -r $config ]]; then (*) config_hosts+=("$host") ;; esac done ;& - (*) shift lines;; + (*) (( ++idx ));; esac done if (( ${#config_hosts} )); then |