--- iselect.pl 2007/10/25 14:11:42 7 +++ iselect.pl 2007/10/25 15:12:43 10 @@ -50,12 +50,13 @@ my $status_text = ''; my $error_text = ''; +my $status_lines = 3; # find which lines are selectable in input file my $selectable_line; for my $l (0 .. $#lines) { - if ($lines[$l] !~ s/^{s}//) { + if ($lines[$l] =~ s/^{s}//) { $selectable_line->{$l}++; } } @@ -82,7 +83,7 @@ sub redraw_line { my ($l,$line) = @_; - if ( defined $selectable_line->{ $l } ) { + if ( defined $selectable_line->{ $l + $top_screen_line } ) { $scr->at($l,0)->bold()->puts( full_line( chunk($line) ) )->normal(); } else { $scr->at($l,0)->puts( full_line( chunk($line) ) ); @@ -90,7 +91,7 @@ } sub redraw { - for my $l (0 .. $scr->rows - 3) { + for my $l (0 .. $scr->rows - $status_lines) { my $line = $lines[ $l + $top_screen_line ]; redraw_line( $l, $line ); last if ($l == $#lines); @@ -102,10 +103,10 @@ my $pcnt = int(($pos || 0) * 100 / ($#lines || 1)); my $pos_txt = sprintf('%d, %d%% ',$pos,$pcnt); - $scr->at($scr->rows - 2,0)->reverse()->puts( + $scr->at($scr->rows - $status_lines + 1,0)->reverse()->puts( sprintf(' %-'.($scr->cols - length($pos_txt) - 2).'s ',$status_text) .$pos_txt)->normal(); - $scr->at($scr->rows - 1,0)->puts( + $scr->at($scr->rows - $status_lines + 2,0)->puts( sprintf('%-'.$scr->cols.'s', $error_text) ); } @@ -117,7 +118,7 @@ redraw_line( $screen_line, $lines[$pos] ); - my $last_screen_line = $scr->rows - 3; + my $last_screen_line = $scr->rows - $status_lines; if ( $d < 0 && $screen_line == 0 ) { if ( $pos > 0 ) { @@ -159,7 +160,7 @@ $error_text = ""; - my $lines_on_screen = $scr->rows - 3; + my $lines_on_screen = $scr->rows - $status_lines; if ($key eq 'ku') { selected( -1 );