/[iselect]/bin/iselect.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/iselect.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7 by dpavlin, Thu Oct 25 14:11:42 2007 UTC revision 8 by dpavlin, Thu Oct 25 14:52:56 2007 UTC
# Line 50  my $sel_pos = 0; Line 50  my $sel_pos = 0;
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;
# Line 90  sub redraw_line { Line 91  sub redraw_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);
# Line 102  sub status { Line 103  sub status {
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  }  }
# Line 117  sub selected { Line 118  sub selected {
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 ) {
# Line 159  while(my $key = $scr->getch()) { Line 160  while(my $key = $scr->getch()) {
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 );

Legend:
Removed from v.7  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26