don't report parse errors to console (lots of invalid terminal output). e.g. cat'ing a binary file will produce thousands of errors, but that's just how it is.

This commit is contained in:
sawka
2022-08-19 15:54:38 -07:00
parent b3a05ac72e
commit e454c170f8
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -47,6 +47,7 @@ class TermWrap {
dataUpdates : DataUpdate[] = [];
loadError : mobx.IObservableValue<boolean> = mobx.observable.box(false);
winSize : WindowSize;
numParseErrors : number = 0;
constructor(elem : Element, sessionId : string, cmdId : string, usedRows : number, termOpts : TermOptsType, winSize : WindowSize, keyHandler : (event : any) => void) {
this.sessionId = sessionId;
@@ -68,6 +69,10 @@ class TermWrap {
cols = maxCols;
}
this.terminal = new Terminal({rows: termOpts.rows, cols: maxCols, fontSize: 14, theme: {foreground: "#d3d7cf"}});
this.terminal._core._inputHandler._parser.setErrorHandler((state) => {
this.numParseErrors++;
return state;
});
this.terminal.open(elem);
if (keyHandler != null) {
this.terminal.onKey(keyHandler);
+1
View File
@@ -145,6 +145,7 @@ type TermOptsType = {
rows : number,
cols : number,
flexrows? : boolean,
maxptysize? : number,
};
type CmdStartPacketType = {