Skip to content

Commit

Permalink
Don't insert end-of-line space if line ends with hyphen or dash
Browse files Browse the repository at this point in the history
  • Loading branch information
dfabulich committed May 1, 2017
1 parent 60af66d commit 00498d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions web/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ Scene.prototype.printLoop = function printLoop() {
}
this.prevLine = "text";
this.screenEmpty = false;
this.printLine(trim(line));
printx(' ', this.target);
this.printLine(line);
}
}
this.rollbackLineCoverage();
Expand All @@ -143,9 +142,11 @@ Scene.prototype.dedent = function dedent(newDent) {};

Scene.prototype.printLine = function printLine(line, parent) {
if (!line) return null;
line = this.replaceVariables(line);
line = this.replaceVariables(line.replace(/^ */, ""));
if (!parent) parent = this.target;
return printx(line, parent);
printx(line, parent);
// insert extra space unless the line ends with hyphen or dash
if (!/[-\u2011-\u2014]$/.test(line)) printx(' ', parent);
};

Scene.prototype.replaceVariables = function (line) {
Expand Down Expand Up @@ -1681,7 +1682,6 @@ Scene.prototype.print = function scene_print(expr) {
this.prevLine = "text";
this.screenEmpty = false;
this.printLine(value);
printx(' ', this.target);
};

// *input_text var
Expand Down
2 changes: 1 addition & 1 deletion xmltranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ XmlScene.prototype.gotoref = function xmlGotoRef(data) {
}

XmlScene.prototype.printLine = function xmlPrintLine(data) {
printx(this.replaceLine(data));
printx(this.replaceLine(data.replace(/^ */, "") + ' '));
}

XmlScene.prototype.replaceLine = function xmlReplaceLine(data) {
Expand Down

0 comments on commit 00498d5

Please sign in to comment.