- Timestamp:
- Jul 27, 2009, 11:23:57 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- d7bcff8
- Parents:
- 8eac1a5
- git-author:
- Nelson Elhage <nelhage@mit.edu> (07/25/09 00:37:50)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (07/27/09 23:23:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Completion/Context.pm
r8eac1a5 r13614e7 41 41 use base qw(Class::Accessor::Fast); 42 42 43 __PACKAGE__->mk_ro_accessors(qw(line point words word word_point)); 43 __PACKAGE__->mk_ro_accessors(qw(line point words word word_point 44 word_start word_end)); 44 45 45 46 sub new { … … 50 51 my $line = $before_point . $after_point; 51 52 my $point = length ($before_point); 52 my ($words, $word, $word_point) = tokenize($line, $point); 53 my ($words, $word, $word_point, 54 $word_start, $word_end) = tokenize($line, $point); 53 55 54 56 my $self = { … … 57 59 words => $words, 58 60 word => $word, 59 word_point => $word_point 61 word_point => $word_point, 62 word_start => $word_start, 63 word_end => $word_end 60 64 }; 61 65 return bless($self, $class); … … 89 93 my @words = (); 90 94 my $cword = 0; 95 my $cword_start; 96 my $cword_end; 91 97 my $word_point; 92 98 93 99 my $word = ''; 100 my $wstart = 0; 94 101 my $skipped = 0; 95 102 … … 114 121 push @words, $word; 115 122 $cword++ unless $wend >= $point; 116 if ($wend >= $point&& !defined($word_point)) {123 if(($wend >= $point) && !defined($word_point)) { 117 124 $word_point = length($word) - ($wend - $point) + $skipped; 125 $cword_start = $wstart; 126 $cword_end = $wend; 118 127 } 119 128 $word = ''; 129 $wstart = pos($line); 120 130 $skipped = 0; 121 131 } … … 124 134 if(length($word)) { die("Internal error, leftover=$word"); } 125 135 126 $word_point = 0 unless defined($word_point); 136 unless(defined($word_point)) { 137 $word_point = 0; 138 $cword_start = $cword_end = 0; 139 } 127 140 128 return (\@words, $cword, $word_point );141 return (\@words, $cword, $word_point, $cword_start, $cword_end); 129 142 } 130 143
Note: See TracChangeset
for help on using the changeset viewer.