Swap Hack font with @azurity/pure-nerd-font which provides more icons than Hack

This commit is contained in:
Ni Rui
2022-09-18 20:20:33 +08:00
parent 7a5dc076ff
commit 57816f731f
5 changed files with 70 additions and 55 deletions

View File

@@ -20,18 +20,19 @@
@charset "utf-8";
@import "~hack-font/build/web/hack.css";
@import "~@azurity/pure-nerd-font/pure-nerd-font.css";
#connector-resource-preload-control-console {
font-family: Hack;
font-family: PureNerdFont;
}
#connector-resource-preload-control-console::after {
content: " ";
font-family: Hack;
font-family: PureNerdFont;
font-weight: bold;
}
#connector-resource-preload-control-console::before {
content: " ";
font-family: Hack;
font-family: PureNerdFont;
font-style: italic;
}

View File

@@ -117,7 +117,7 @@ import { consoleScreenKeys } from "./screen_console_keys.js";
import "./screen_console.css";
import "xterm/css/xterm.css";
const termTypeFace = "Hack";
const termTypeFace = "PureNerdFont";
const termFallbackTypeFace = "monospace";
const termTypeFaceLoadTimeout = 3000;
const termTypeFaceLoadError =
@@ -200,46 +200,48 @@ class Term {
}
});
this.term.attachCustomKeyEventHandler(async (ev) => {
if (this.closed) {
return true;
}
// It seems Xtermjs now handles copy paste by itself, following code is no
// longer useful
// this.term.attachCustomKeyEventHandler(async (ev) => {
// if (this.closed) {
// return true;
// }
if (
ev.type == "keyup" &&
((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) ||
(ev.key === "Insert" && ev.shiftKey))
) {
try {
let text = await window.navigator.clipboard.readText();
// if (
// ev.type == "keyup" &&
// ((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) ||
// (ev.key === "Insert" && ev.shiftKey))
// ) {
// try {
// let text = await window.navigator.clipboard.readText();
this.writeEchoStr(text);
} catch (e) {
alert(
"Unable to paste: " +
e +
". Please try again without using the Control+Shift+V / " +
"Shift+Insert hot key"
);
}
return false;
}
// this.writeEchoStr(text);
// } catch (e) {
// alert(
// "Unable to paste: " +
// e +
// ". Please try again without using the Control+Shift+V / " +
// "Shift+Insert hot key"
// );
// }
// return false;
// }
if (
ev.type == "keyup" &&
((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) ||
(ev.key === "Insert" && ev.ctrlKey))
) {
try {
window.navigator.clipboard.writeText(this.term.getSelection());
} catch (e) {
alert("Unable to copy: " + e);
}
return false;
}
// if (
// ev.type == "keyup" &&
// ((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) ||
// (ev.key === "Insert" && ev.ctrlKey))
// ) {
// try {
// window.navigator.clipboard.writeText(this.term.getSelection());
// } catch (e) {
// alert("Unable to copy: " + e);
// }
// return false;
// }
return true;
});
// return true;
// });
let resizeDelay = null,
oldRows = 0,