Skip to content

Commit

Permalink
Better handle pattern matching against longer strings, so we only sho…
Browse files Browse the repository at this point in the history
…w the relevant part.
  • Loading branch information
jnthn committed Aug 21, 2012
1 parent fbc95e1 commit f0d590e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/Debugger/UI/CommandLine.pm
Expand Up @@ -110,10 +110,16 @@ my class SourceFile {
my $cur = try eval_in_ctx($ctx, q[DYNAMIC::<$¢>]); my $cur = try eval_in_ctx($ctx, q[DYNAMIC::<$¢>]);
if $cur ~~ Cursor { if $cur ~~ Cursor {
my $pos = $cur.pos; my $pos = $cur.pos;
my $before = $cur.target.substr(0, $pos); my $str = $cur.target.subst("\n", '\n', :g).subst("\t", '\t', :g);
my $after = $cur.target.substr($pos); my $before = $str.substr(0, $pos);
if $cur.target.chars > 77 { my $after = $str.substr($pos);

if $str.chars > 77 {
if $after.chars > 50 {
$after = $after.substr(0, 50) ~ '...';
}
if $before.chars > (74 - $after.chars) {
$before = "..." ~ $before.substr(* - (74 - $after.chars));
}
} }
return normal_lines( return normal_lines(
[ [
Expand Down

0 comments on commit f0d590e

Please sign in to comment.