Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bolden current line in list command

  • Loading branch information...
commit b928305cf10b2c12b90fcc9297740577cf716448 1 parent 55af2e4
Rocky Bernstein authored
19 lib/Devel/Trepan/CmdProcessor/Command/List.pm
View
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
+# Copyright (C) 2011-2012, 2014, 2015 Rocky Bernstein <rocky@cpan.org>
use warnings; no warnings 'redefine';
use rlib '../../../..';
@@ -262,7 +262,8 @@ sub run($$)
my $bp;
local(*DB::dbline) = "::_<$filename";
my $lineno;
- my $msg = sprintf("%s [%d-%d]", $proc->canonic_file($filename), $start, $end);
+ my $msg = sprintf("%s [%d-%d]",
+ $proc->canonic_file($filename), $start, $end);
# FIXME: put in frame?
my $frame_filename = $proc->filename();
@@ -302,11 +303,17 @@ sub run($$)
$s .= ' ';
}
## FIXME move above code
-
- $s .= ($proc->{frame} && $lineno == $proc->line &&
- $frame_filename eq $filename) ? '->' : $a_pad;
my $opts = {unlimited => 1};
- $proc->msg("$s\t$line", $opts);
+ my $mess;
+ if ($proc->{frame} && $lineno == $proc->line &&
+ $frame_filename eq $filename) {
+ $s .= '->';
+ $s = $proc->bolden($s);
+ } else {
+ $s .= $a_pad;
+ }
+ $mess = "$s\t$line";
+ $proc->msg($mess, $opts);
}
$proc->{list_line} = $lineno + $center_correction;
$proc->{list_filename} = $filename;
12 lib/Devel/Trepan/CmdProcessor/Msg.pm
View
@@ -104,12 +104,22 @@ sub safe_rep($$) {
Devel::Trepan::Util::safe_repr($str, $self->{settings}{maxstring});
}
+sub bolden($$) {
+ my($self, $message) = @_;
+ if ($self->{settings}{highlight} && $HAVE_TERM_ANSIColor) {
+ return $message = color('bold') . $message . color('reset');
+ } else {
+ return $message
+ }
+ return color('bold') . $message . color('reset');
+}
+
sub section($$;$) {
my($self, $message, $opts) = @_;
$opts ||= {};
$message = $self->safe_rep($message) unless $self->{opts}{unlimited};
if ($self->{settings}{highlight} && $HAVE_TERM_ANSIColor) {
- $message = color('bold') . $message . color('reset');
+ $message = $self->bolden($message);
} else {
$message .= "\n" . '-' x length($message);
}
Please sign in to comment.
Something went wrong with that request. Please try again.