- $link = substr $rows[$after], 0, $trim;
- # advance lookbehind offset on the next page
- $penalty = 0;
- for ($offset .. $after) {
- last if $rows[$_] =~ /^\Q$link/;
- $lookbehind++;
+ $enlarged = 0;
+ for ($offset + 1 .. $after) {
+ my $prefix = substr $rows[$_], 0, $trim;
+ # advance lookbehind offset on the next page
+ $shrunk++;
+ next if $link =~ /^\Q$prefix/;
+ $link = $prefix;
+ last;