Code clean up for ui/widgets/screen_console.vue

This commit is contained in:
Ni Rui
2022-07-22 15:48:00 +08:00
parent eb5ac10115
commit 519336f545

View File

@@ -109,7 +109,7 @@
import FontFaceObserver from "fontfaceobserver"; import FontFaceObserver from "fontfaceobserver";
import { Terminal } from "xterm"; import { Terminal } from "xterm";
import { WebLinksAddon } from "xterm-addon-web-links"; import { WebLinksAddon } from "xterm-addon-web-links";
import { WebglAddon } from "xterm-addon-webgl"; // import { WebglAddon } from "xterm-addon-webgl";
import { FitAddon } from "xterm-addon-fit"; import { FitAddon } from "xterm-addon-fit";
import { isNumber } from "../commands/common.js"; import { isNumber } from "../commands/common.js";
import { consoleScreenKeys } from "./screen_console_keys.js"; import { consoleScreenKeys } from "./screen_console_keys.js";
@@ -144,13 +144,12 @@ class Term {
fontFamily: termTypeFace + ", " + termFallbackTypeFace, fontFamily: termTypeFace + ", " + termFallbackTypeFace,
fontSize: this.fontSize, fontSize: this.fontSize,
logLevel: process.env.NODE_ENV === "development" ? "info" : "off", logLevel: process.env.NODE_ENV === "development" ? "info" : "off",
theme: {
background: this.control.activeColor(),
},
}); });
this.fit = new FitAddon(); this.fit = new FitAddon();
this.term.options.theme = {
background: this.control.activeColor(),
};
this.term.onData((data) => { this.term.onData((data) => {
if (this.closed) { if (this.closed) {
return; return;
@@ -365,7 +364,7 @@ class Term {
return; return;
} }
this.term.setOption("fontFamily", value); this.term.options.fontFamily = value;
this.refit(); this.refit();
} }
@@ -379,7 +378,7 @@ class Term {
} }
this.fontSize += 2; this.fontSize += 2;
this.term.setOption("fontSize", this.fontSize); this.term.options.fontSize = this.fontSize;
this.refit(); this.refit();
} }
@@ -393,7 +392,7 @@ class Term {
} }
this.fontSize -= 2; this.fontSize -= 2;
this.term.setOption("fontSize", this.fontSize); this.term.options.fontSize = this.fontSize;
this.refit(); this.refit();
} }