Skip to content
Browse files

Ensure the source is terminated with a newline.

  • Loading branch information...
1 parent eee670d commit 6cae226b24bcaef515d7481a640f39f2810df61f @jnthn committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Debugger/UI/CommandLine.pm
View
5 lib/Debugger/UI/CommandLine.pm
@@ -13,6 +13,11 @@ my class SourceFile {
has @!line_offsets;
method BUILD(:$!filename, :$!source) {
+ # Ensure source ends with a newline.
+ unless $!source ~~ /\n$/ {
+ $!source ~= "\n";
+ }
+
# Store (abbreviated if needed) lines.
@!lines = lines($!source).map(-> $l {
$l.chars > 77 ?? $l.substr(0, 74) ~ '...' !! $l

0 comments on commit 6cae226

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