Skip to content
Browse files

Fix edge cases in regex trace output.

  • Loading branch information...
1 parent c0f36a1 commit 9b63ea8f98a5e14cd727bfc62b24926023557c84 @jnthn committed Sep 28, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/Debugger/UI/CommandLine.pm
View
12 lib/Debugger/UI/CommandLine.pm
@@ -110,12 +110,12 @@ my class SourceFile {
my $cur = try eval_in_ctx($ctx, q[DYNAMIC::<$¢>]);
if $cur ~~ Cursor {
my $pos = $cur.pos;
- my $str = $cur.target.subst("\n", '\n', :g).subst("\t", '\t', :g);
- my $before = $str.substr(0, $pos);
- my $after = $str.substr($pos);
- if $str.chars > 77 {
- if $after.chars > 50 {
- $after = $after.substr(0, 50) ~ '...';
+ my $str = $cur.target;
+ my $before = $str.substr(0, $pos).subst(/\n/, '\n', :g).subst(/\t/, '\t', :g);
+ my $after = $str.substr($pos).subst(/\n/, '\n', :g).subst(/\t/, '\t', :g);
+ if $before.chars + $after.chars > 77 {
+ if $after.chars > 43 {
+ $after = $after.substr(0, 40) ~ '...';
}
if $before.chars > (74 - $after.chars) {
$before = "..." ~ $before.substr(* - (74 - $after.chars));

0 comments on commit 9b63ea8

Please sign in to comment.
Something went wrong with that request. Please try again.