removing miker-filter series; superceded by filter_record_ids, which has far less...
[migration-tools.git] / marc-cleanup
index fb4f702..58b59a8 100755 (executable)
@@ -33,9 +33,12 @@ open my $EXMARC, '>:utf8', $conf->{exception};
 # 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,
@@ -187,6 +190,9 @@ sub edit {
     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;
@@ -339,8 +345,8 @@ sub merge_lines {
     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;
 }
@@ -360,14 +366,26 @@ sub dump_record {
     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;