From dd225747db944fd24bd90f5c1624f17929d6bdd8 Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Mon, 3 Nov 2008 22:46:08 +0000 Subject: [PATCH] substitute, merge_lines, kill_line updated --- marc-cleanup | 25 ++++++------------------- 1 files changed, 6 insertions(+), 19 deletions(-) diff --git a/marc-cleanup b/marc-cleanup index 897ca71..6cfd6f4 100755 --- a/marc-cleanup +++ b/marc-cleanup @@ -184,12 +184,7 @@ sub edit { my $term = $commands{$chunks[0]}->(@chunks[1..$#chunks]); last if $term; } else { - if ($context[3] eq " [LINE KILLED]\n") { - push @record, "$line\n" - } else { - $record[-1] = "$line\n"; - } - $context[3] = "$line\n"; + $record[$recptr] = "$line\n"; print_linecontext(); } } @@ -297,29 +292,21 @@ sub substitute { $char = "\\" . $char if ($char =~ /\W/); $from = join('', $from, $char); } - $record[-1] =~ s/$from/$to/; - $context[3] = $record[-1]; + $record[$recptr] =~ s/$from/$to/; print_linecontext(); return 0; } sub merge_lines { - my $last = pop @record; - $last =~ s/^\s+//; - $record[-1] =~ s/\n//; - $record[-1] = join('', $record[-1], $last); - my @temp = ("\n"); - push @temp, @context[0..1]; - $temp[3] = $record[-1]; - $temp[4] = $context[4]; - @context = @temp; + $record[$recptr] =~ s/^\s*//; + $record[$recptr - 1] =~ s|\n||; + $record[$recptr - 1] = join('', $record[$recptr - 1], $record[$recptr]); print_linecontext(); return 0; } sub kill_line { - pop @record; - $context[3] = " [LINE KILLED]\n"; + delete $record[$recptr]; print_linecontext(); return 0; } -- 1.7.2.5