diff --git a/exec/fseditor.js b/exec/fseditor.js
index 444e155bb24566dbd124f578d3cc13c75740bb22..4772bde4a8a70389dbe4a6038c16d920ac836281 100644
--- a/exec/fseditor.js
+++ b/exec/fseditor.js
@@ -775,8 +775,11 @@ function make_string(soft,colour)
 		else {
 			str.=line[i].text;
 		}
-		if(soft || line[i].hardcr)
+		if(soft || line[i].hardcr) {
+			/* Trim whitespace */
+			str=str.replace(/\s*$/,'');
 			str+='\n';
+		}
 	}
 	return(str);
 }