# edit(), below
my %commands = ( c => \&print_context,
C => \&print_linecontext,
- k => \&kill_line,
o => \&show_original,
+ f => \&flip_lines,
+ k => \&kill_line,
m => \&merge_lines,
+ n => \&next_line,
+ p => \&prev_line,
s => \&substitute,
t => \&commit_edit,
x => \&dump_record,
message($msg, 1);
print_context();
+ # stow original problem line
+ $conf->{origline} = $record[$recptr];
+
while (1) {
my $line = $term->readline('marc-cleanup>');
my @chunks = split /\s+/, $line;
my @a = @record[0 .. $recptr - 1];
my @b = @record[$recptr + 1 .. $#record];
@record = (@a, @b);
- # move recorde pointer to previous line
- $recptr--;
+ # move record pointer to previous line
+ prev_line();
print_linecontext();
return 0;
}
return 1;
}
-sub commit_edit { return 1 }
+sub next_line {
+ $recptr++;
+ print_linecontext();
+ return 0;
+}
+
+sub prev_line {
+ $recptr--;
+ print_linecontext();
+ return 0;
+}
sub show_original {
my ($line_in) = @_;
- print $OUT "\n$line_in\n";
+ print $OUT "\n", $conf->{origline}, "\n";
return 0;
}
+sub commit_edit { return 1 }
+
sub help {
print $OUT <<HELP;