Permalink
Browse files

Bugs in saving and returning lines when we want plain output.

  • Loading branch information...
1 parent af4a1eb commit f3a12f44421a8657689fda7933f62cd126e3326e Rocky Bernstein committed Nov 14, 2012
Showing with 6 additions and 4 deletions.
  1. +1 −0 MANIFEST
  2. +5 −4 lib/Devel/Trepan/DB/LineCache.pm
View
1 MANIFEST
@@ -212,6 +212,7 @@ t/10test-io-tcppack.t
t/10test-io-tcpserver.t
t/10test-linecache.t
t/10test-load.t
+t/10test-location.t
t/10test-options.t
t/10test-pod2text.t
t/10test-position.t
View
9 lib/Devel/Trepan/DB/LineCache.pm
@@ -451,9 +451,10 @@ sub getlines($;$)
if (exists $file_cache{$filename}) {
my $lines_href = $file_cache{$filename}{lines_href};
my $lines_aref = $lines_href->{$format};
+ return $lines_href->{plain} if $format eq 'plain';
if ($opts->{output} && !defined $lines_aref) {
my @formatted_lines = ();
- my $lines_aref = $lines_href->{plain};
+ $lines_aref = $lines_href->{plain};
for my $line (@$lines_aref) {
push @formatted_lines, highlight_string($line);
## print $formatted_text;
@@ -873,7 +874,7 @@ sub update_script_cache($$)
}
}
$lines_href->{$opts->{output}} = highlight_string($string) if
- $opts->{output};
+ $opts->{output} && $opts->{output} ne 'plain';
my $entry = {
lines_href => $lines_href,
@@ -1067,7 +1068,7 @@ sub update_cache($;$)
use strict;
$lines_href = {};
$lines_href->{plain} = $raw_lines;
- if ($opts->{output} && defined($raw_lines)) {
+ if ($opts->{output} && $opts->{output} ne 'plain' && defined($raw_lines)) {
# Some lines in $raw_lines may be undefined
no strict; no warnings;
local $WARNING=0;
@@ -1106,7 +1107,7 @@ sub update_cache($;$)
if ( -r $path ) {
my @lines = readlines($path);
$lines_href = {plain => \@lines};
- if ($opts->{output}) {
+ if ($opts->{output} && $opts->{output} ne 'plain') {
my $highlight_lines = highlight_string(join('', @lines));
my @highlight_lines = split(/\n/, $highlight_lines);
$lines_href->{$opts->{output}} = \@highlight_lines;

0 comments on commit f3a12f4

Please sign in to comment.