Changeset af21934 for perl/lib/BarnOwl/Completion
- Timestamp:
- Mar 2, 2010, 9:14:44 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 2d232ed
- Parents:
- ccafe64
- git-author:
- David Benjamin <davidben@mit.edu> (02/27/10 21:52:26)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/02/10 21:14:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Completion/Context.pm
re97c5d05 raf21934 54 54 my ($words, $word, $word_point, 55 55 $word_start, $word_end) = tokenize($line, $point); 56 push @$words, '' if scalar @$words <= $word; 56 57 57 58 my $self = { … … 124 125 my $wstart = 0; 125 126 my $skipped = 0; 127 my $have_word = 0; 126 128 127 129 pos($line) = 0; … … 129 131 if($line =~ m{\G ($boring+) }gcx) { 130 132 $word .= $1; 133 $have_word = 1; 131 134 } elsif ($line =~ m{\G ($quote)}gcx) { 132 135 my $chr = $1; … … 139 142 pos($line) = length($line); 140 143 } 144 $have_word = 1; 141 145 } 142 146 143 147 if ($line =~ m{\G ($space+|$)}gcx) { 144 148 my $wend = pos($line) - length($1); 145 push @words, $word; 146 $cword++ unless $wend >= $point; 147 if(($wend >= $point) && !defined($word_point)) { 148 $word_point = length($word) - ($wend - $point) + $skipped; 149 $cword_start = $wstart; 150 $cword_end = $wend; 149 if ($have_word) { 150 push @words, $word; 151 $cword++ unless $wend >= $point; 152 if(($wend >= $point) && !defined($word_point)) { 153 $word_point = length($word) - ($wend - $point) + $skipped; 154 $cword_start = $wstart; 155 $cword_end = $wend; 156 } 151 157 } 158 # Always reset, so we get $wstart right 152 159 $word = ''; 153 160 $wstart = pos($line); 154 161 $skipped = 0; 162 $have_word = 0; 155 163 } 156 164 } … … 161 169 $word_point = 0; 162 170 $cword_start = $cword_end = $point; 163 push @words, '' if $point > 0;164 171 } 165 172
Note: See TracChangeset
for help on using the changeset viewer.