Skip to content

Commit

Permalink
Ensure the source is terminated with a newline.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Aug 19, 2012
1 parent eee670d commit 6cae226
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Debugger/UI/CommandLine.pm
Expand Up @@ -13,6 +13,11 @@ my class SourceFile {
has @!line_offsets; has @!line_offsets;


method BUILD(:$!filename, :$!source) { method BUILD(:$!filename, :$!source) {
# Ensure source ends with a newline.
unless $!source ~~ /\n$/ {
$!source ~= "\n";
}

# Store (abbreviated if needed) lines. # Store (abbreviated if needed) lines.
@!lines = lines($!source).map(-> $l { @!lines = lines($!source).map(-> $l {
$l.chars > 77 ?? $l.substr(0, 74) ~ '...' !! $l $l.chars > 77 ?? $l.substr(0, 74) ~ '...' !! $l
Expand Down

0 comments on commit 6cae226

Please sign in to comment.