Skip to content

Commit

Permalink
Fix pprint-indent with indentation string.
Browse files Browse the repository at this point in the history
  • Loading branch information
PerBothner committed Jul 1, 2018
1 parent 6cf4c4f commit 740d082
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions hlib/domterm-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ span[line][breaking="yes"] > span.pprint-pre-break :after { content: "\A" }
span[line] > span.pprint-pre-break { display: none }
span[line][breaking="yes"] > span.pprint-post-break { display: inline }
span[line] > span.pprint-post-break { display: none }
span.pprint-indentation[value]:before { content: attr(value); }
12 changes: 7 additions & 5 deletions hlib/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6900,11 +6900,13 @@ DomTerm.prototype._breakAllLines = function(startLine = -1) {
if (indent instanceof Element) {
indent = indent.cloneNode(false);
el.insertBefore(indent, insertPosition);
if (countColumns)
curPosition +=
dt.strWidthInContext(el.textContent, el) * dt.charWidth;
else
curPosition = el.offsetLeft + el.offsetWidth;
if (countColumns) {
let t = indent.getAttribute("value");
if (! t)
t = el.textContent;
curPosition += dt.strWidthInContext(t, el) * dt.charWidth;
} else
curPosition += indent.offsetWidth;
goalPosition = curPosition;
}
else
Expand Down

0 comments on commit 740d082

Please sign in to comment.