Skip to content

Commit

Permalink
Lazy line-breaking and other changes lead to major speedup
Browse files Browse the repository at this point in the history
cat of large files is 3-4 times faster.
Windows resize is much faster (especially near end of buffer).
Smarter scheduling of updateDisplay.
  • Loading branch information
PerBothner committed Aug 16, 2021
1 parent bbaa53c commit f701705
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 88 deletions.
1 change: 1 addition & 0 deletions hlib/domterm-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ div.input-line, div.command-group, div.domterm { position: relative }

html, body { width: 100%; height: 100%; margin: 0px; overflow: hidden }
div.domterm { -webkit-user-select: text; overflow: hidden }
div.interaction { overflow-x: hidden }
div.domterm { width: 100%; height: 100%; margin: 0px; padding: 0px; border: 0px }
div.domterm-buffers { overflow-y: scroll; width: 100%; height: 100%; }
div.domterm.xterm { overflow-y: hidden }
Expand Down
6 changes: 5 additions & 1 deletion hlib/domterm-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ class DTParser {
let lineStart = term.lineStarts[term.getAbsCursorLine()];
if (lineStart._widthMode < Terminal._WIDTH_MODE_TAB_SEEN)
lineStart._widthMode = Terminal._WIDTH_MODE_TAB_SEEN;
lineStart._breakState = Terminal._BREAKS_UNMEASURED;
let col = term.getCursorColumn();
if (lineStart._widthColumns !== undefined
&& col > lineStart._widthColumns)
Expand Down Expand Up @@ -1556,6 +1557,7 @@ class DTParser {
if (term.currentCursorColumn >= 0)
term.currentCursorColumn += wcols;
line._widthMode = Terminal._WIDTH_MODE_VARIABLE_SEEN;
line._breakState = Terminal._BREAKS_UNMEASURED;
term.moveToAbs(oldLine+hlines-1, oldColumn+wcols, true);
} else
console.log("handleDeviceControlString");
Expand Down Expand Up @@ -1996,7 +1998,6 @@ class DTParser {
term.outputContainer = term.outputBefore.parentNode;
term.resetCursorCache();
term._restoreLineTables(term.topNode, 0);
dt._restoreSaveLastLine();
DomTerm._addMouseEnterHandlers(term);
if (data.rows && data.columns)
dt.forceWidthInColumns(data.columns, data.rows, 8);
Expand Down Expand Up @@ -2038,6 +2039,7 @@ class DTParser {
let lineStart = term.lineStarts[term.getAbsCursorLine()];
if (lineStart._widthMode < Terminal._WIDTH_MODE_PPRINT_SEEN)
lineStart._widthMode = Terminal._WIDTH_MODE_PPRINT_SEEN;
lineStart._breakState = Terminal._BREAKS_UNMEASURED;
}
var ppgroup = term._createSpanNode("pprint-group");
text = text.trim();
Expand Down Expand Up @@ -2096,6 +2098,7 @@ class DTParser {
let lineStart = term.lineStarts[term.getAbsCursorLine()];
if (lineStart._widthMode < Terminal._WIDTH_MODE_PPRINT_SEEN)
lineStart._widthMode = Terminal._WIDTH_MODE_PPRINT_SEEN;
lineStart._breakState = Terminal._BREAKS_UNMEASURED;
var line = term._createLineNode(kind);
text = text.trim();
if (text.length > 0) {
Expand All @@ -2116,6 +2119,7 @@ class DTParser {
term.outputContainer);
if (lineStart._widthColumns !== undefined)
lineStart._widthColumns += w;
lineStart._breakState = Terminal._BREAKS_UNMEASURED;
if (term.currentCursorColumn >= 0)
term.currentCursorColumn += w;
}
Expand Down
Loading

0 comments on commit f701705

Please sign in to comment.