From 4a67e6cfc9c94bfb1fb24007bfd74fe1b5c3d840 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 27 Apr 2020 02:04:54 +0000
Subject: [PATCH] Do the putmsg() thing with word-wrap that I talked about a
 few commits ago: Only trim the trailing white-space post-word-wrap if there
 was not a trailing newline on the original string.

---
 exec/load/frame.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/exec/load/frame.js b/exec/load/frame.js
index f079acac2e..fdacb11d4d 100644
--- a/exec/load/frame.js
+++ b/exec/load/frame.js
@@ -1016,7 +1016,9 @@ Frame.prototype.putmsg = function(str,attr) {
 		var remainingWidth = this.width - this.__position__.cursor.x;
 		if(str.length > remainingWidth) {
 			str = word_wrap(str,remainingWidth,str.length,false).split('\n');
-			str = str.shift() + '\r\n' + word_wrap(str.join('\r\n'),this.width,remainingWidth,false).trimRight();
+			var trailing_newline = str[str.length - 1].length == 0;
+			str = str.shift() + '\r\n' + word_wrap(str.join('\r\n'),this.width,remainingWidth,false);
+			if(!trailing_newline) str = str.trimRight();
 		}
 	}
 	str = str.toString().split('');
-- 
GitLab