Changeset e711ca7


Ignore:
Timestamp:
Jul 29, 2009, 9:41:44 PM (8 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4fbc7f5
Parents:
2b37be2
git-author:
Nelson Elhage <nelhage@mit.edu> (07/29/09 21:22:25)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/29/09 21:41:44)
Message:
complete_flags: Don't complete options after --.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl/Completion/Util.pm

    r82a6e8b re711ca7  
    1919    my $flag = undef;
    2020
     21    my $word = 0;
     22    my $optsdone = 0;
     23
    2124    while($idx < $ctx->word) {
    2225        my $word = $ctx->words->[$idx];
    23         BarnOwl::debug("[completing] idx=$idx word=$word ctx->word=@{[$ctx->word]}");
    2426        if($flag) {
    2527            undef $flag;
    2628        } elsif($word =~ m{^--}) {
    27             last if $word eq '--';
     29            if($word eq '--') {
     30                $optsdone = 1;
     31                last;
     32            }
    2833            $flag = $word if(exists $args->{$word});
    2934        } elsif ($word =~ m{^-}) {
     
    3540
    3641    if($flag) {
    37         BarnOwl::debug("END: flag=$flag");
    3842        my $c = $args->{$flag};
    3943        if($c) {
     
    4246        return;
    4347    } else {
    44         return (@$no_args,
    45                 keys %$args,
     48        return ($optsdone ? () : (@$no_args, keys %$args),
    4649                $default ? ($default->($ctx)) : ());
    4750    }
  • t/completion.t

    rc4efb46 re711ca7  
    167167              [qw(-n -C -m -c -i -r -O nelhage asedeno geofft)]);
    168168
     169test_complete('zwrite -c nelhage -- ', '',
     170              [qw(nelhage asedeno geofft)]);
     171
    1691721;
    170173
Note: See TracChangeset for help on using the changeset viewer.