50 |
my $status_text = ''; |
my $status_text = ''; |
51 |
my $error_text = ''; |
my $error_text = ''; |
52 |
|
|
53 |
|
my $status_lines = 3; |
54 |
|
|
55 |
# find which lines are selectable in input file |
# find which lines are selectable in input file |
56 |
my $selectable_line; |
my $selectable_line; |
57 |
|
|
58 |
for my $l (0 .. $#lines) { |
for my $l (0 .. $#lines) { |
59 |
if ($lines[$l] !~ s/^{s}//) { |
if ($lines[$l] =~ s/^{s}//) { |
60 |
$selectable_line->{$l}++; |
$selectable_line->{$l}++; |
61 |
} |
} |
62 |
} |
} |
83 |
sub redraw_line { |
sub redraw_line { |
84 |
my ($l,$line) = @_; |
my ($l,$line) = @_; |
85 |
|
|
86 |
if ( defined $selectable_line->{ $l } ) { |
if ( defined $selectable_line->{ $l + $top_screen_line } ) { |
87 |
$scr->at($l,0)->bold()->puts( full_line( chunk($line) ) )->normal(); |
$scr->at($l,0)->bold()->puts( full_line( chunk($line) ) )->normal(); |
88 |
} else { |
} else { |
89 |
$scr->at($l,0)->puts( full_line( chunk($line) ) ); |
$scr->at($l,0)->puts( full_line( chunk($line) ) ); |
91 |
} |
} |
92 |
|
|
93 |
sub redraw { |
sub redraw { |
94 |
for my $l (0 .. $scr->rows - 3) { |
for my $l (0 .. $scr->rows - $status_lines) { |
95 |
my $line = $lines[ $l + $top_screen_line ]; |
my $line = $lines[ $l + $top_screen_line ]; |
96 |
redraw_line( $l, $line ); |
redraw_line( $l, $line ); |
97 |
last if ($l == $#lines); |
last if ($l == $#lines); |
103 |
my $pcnt = int(($pos || 0) * 100 / ($#lines || 1)); |
my $pcnt = int(($pos || 0) * 100 / ($#lines || 1)); |
104 |
my $pos_txt = sprintf('%d, %d%% ',$pos,$pcnt); |
my $pos_txt = sprintf('%d, %d%% ',$pos,$pcnt); |
105 |
|
|
106 |
$scr->at($scr->rows - 2,0)->reverse()->puts( |
$scr->at($scr->rows - $status_lines + 1,0)->reverse()->puts( |
107 |
sprintf(' %-'.($scr->cols - length($pos_txt) - 2).'s ',$status_text) |
sprintf(' %-'.($scr->cols - length($pos_txt) - 2).'s ',$status_text) |
108 |
.$pos_txt)->normal(); |
.$pos_txt)->normal(); |
109 |
$scr->at($scr->rows - 1,0)->puts( |
$scr->at($scr->rows - $status_lines + 2,0)->puts( |
110 |
sprintf('%-'.$scr->cols.'s', $error_text) |
sprintf('%-'.$scr->cols.'s', $error_text) |
111 |
); |
); |
112 |
} |
} |
118 |
|
|
119 |
redraw_line( $screen_line, $lines[$pos] ); |
redraw_line( $screen_line, $lines[$pos] ); |
120 |
|
|
121 |
my $last_screen_line = $scr->rows - 3; |
my $last_screen_line = $scr->rows - $status_lines; |
122 |
|
|
123 |
if ( $d < 0 && $screen_line == 0 ) { |
if ( $d < 0 && $screen_line == 0 ) { |
124 |
if ( $pos > 0 ) { |
if ( $pos > 0 ) { |
160 |
|
|
161 |
$error_text = ""; |
$error_text = ""; |
162 |
|
|
163 |
my $lines_on_screen = $scr->rows - 3; |
my $lines_on_screen = $scr->rows - $status_lines; |
164 |
|
|
165 |
if ($key eq 'ku') { |
if ($key eq 'ku') { |
166 |
selected( -1 ); |
selected( -1 ); |