Skip to content

Commit

Permalink
Bugs in saving and returning lines when we want plain output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky Bernstein committed Nov 14, 2012
1 parent af4a1eb commit f3a12f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/Devel/Trepan/DB/LineCache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f3a12f4

Please sign in to comment.