Changeset c4efb46


Ignore:
Timestamp:
Jul 28, 2009, 11:20:30 PM (12 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:
19cc7b00
Parents:
216b1d0
Message:
Completion: Fix a min/max confusion.

This could cause completion to insert a completion in some situations
even if it was not unique.
Files:
2 edited

Legend:

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

    rf987504 rc4efb46  
    1818                        point_move replace_region);
    1919
    20 use List::Util qw(max first);
     20use List::Util qw(min first);
    2121
    2222our %completers = ();
     
    7676sub common_prefix {
    7777    my @words = @_;
    78     my $len   = max(map {length($_)} @words);
     78    my $len   = min(map {length($_)} @words);
    7979    my $pfx = '';
    8080    for my $i (1..$len) {
  • t/completion.t

    r7be5d8b rc4efb46  
    122122is(BarnOwl::Completion::common_prefix(qw(abc abc)), 'abc');
    123123
     124is(BarnOwl::Completion::common_prefix('a', ''), '');
     125
    124126## Test complete_flags
    125127
Note: See TracChangeset for help on using the changeset viewer.