diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2003-09-24 14:53:19 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-09-24 14:53:19 +0000 |
commit | 0c82828e8679105adcb53765f8a65f666b08f7c4 (patch) | |
tree | 5e80beec173c7985095a28d9e8f1ead1846e3409 | |
parent | 58bad19411cce9ee0a0edf3ef93acb475b7e7a79 (diff) | |
download | zsh-0c82828e8679105adcb53765f8a65f666b08f7c4.tar.gz zsh-0c82828e8679105adcb53765f8a65f666b08f7c4.tar.xz zsh-0c82828e8679105adcb53765f8a65f666b08f7c4.zip |
unposted: improve Perforce label completion
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Completion/Unix/Command/_perforce | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 93efdb2c4..25c4157b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-24 Peter Stephenson <pws@csr.com> + + * unposted: Completion/Unix/Command/_perforce: improve handling + of label completion: now faster and uses filename to narrow + range if after `@'. + 2003-09-22 Peter Stephenson <pws@csr.com> * 19105: Src/init.c, Src/jobs.c: Set shout to stderr if we diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index a76b64f52..8147244ba 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -875,7 +875,7 @@ _perforce_files() { _alternative \ "changes:change:_perforce_changes $range -tf" \ clients:client:_perforce_clients \ - labels:label:_perforce_labels \ + "labels:label:_perforce_labels -tf" \ 'dates:date (+ time):_perforce_dates' elif [[ -prefix *\# ]]; then # Modify context to indicate we are in a suffix. @@ -1138,17 +1138,17 @@ _perforce_jobviews() { (( $+functions[_perforce_labels] )) || _perforce_labels() { - local lline match mbegin mend - local -a ll + local lline file + local -a ll match mbegin mend - # May be completing after `@'. - compset -P '*@' + if [[ $argv[-1] = -tf ]]; then + argv=($argv[1,-2]) + # Completing after `@'. + file=${${(Q)PREFIX}%%@*} + compset -P '*@' + fi - _perforce_call_p4 labels labels | while read lline; do - if [[ $lline = (#b)'Label '([^[:blank:]]##)' '(*) ]]; then - ll+=("${match[1]}:${match[2]}") - fi - done + ll=(${${(f)"$(_perforce_call_p4 labels labels ${file:+\$file})"}//(#b)Label\ ([^[:blank:]]##)\ (*)/$match[1]:$match[2]}) _describe -t labels 'Perforce label' ll } |