mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
term scrollback size and reduce cache frequency (#978)
This commit is contained in:
parent
d9d19f8368
commit
92fd371fc9
@ -304,6 +304,19 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
|
||||
const termTheme = computeTheme(fullConfig, blockData?.meta?.["term:theme"]);
|
||||
const themeCopy = { ...termTheme };
|
||||
themeCopy.background = "#00000000";
|
||||
let termScrollback = 1000;
|
||||
if (termSettings?.["term:scrollback"]) {
|
||||
termScrollback = Math.floor(termSettings["term:scrollback"]);
|
||||
}
|
||||
if (blockData?.meta?.["term:scrollback"]) {
|
||||
termScrollback = Math.floor(blockData.meta["term:scrollback"]);
|
||||
}
|
||||
if (termScrollback < 0) {
|
||||
termScrollback = 0;
|
||||
}
|
||||
if (termScrollback > 10000) {
|
||||
termScrollback = 10000;
|
||||
}
|
||||
const termWrap = new TermWrap(
|
||||
blockId,
|
||||
connectElemRef.current,
|
||||
@ -315,6 +328,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
|
||||
fontWeight: "normal",
|
||||
fontWeightBold: "bold",
|
||||
allowTransparency: true,
|
||||
scrollback: termScrollback,
|
||||
},
|
||||
{
|
||||
keydownHandler: handleTerminalKeydown,
|
||||
|
@ -21,6 +21,7 @@ const dlog = debug("wave:termwrap");
|
||||
|
||||
const TermFileName = "term";
|
||||
const TermCacheFileName = "cache:term:full";
|
||||
const MinDataProcessedForCache = 100 * 1024;
|
||||
|
||||
// detect webgl support
|
||||
function detectWebGLSupport(): boolean {
|
||||
@ -250,7 +251,7 @@ export class TermWrap {
|
||||
}
|
||||
|
||||
processAndCacheData() {
|
||||
if (this.dataBytesProcessed < 10 * 1024) {
|
||||
if (this.dataBytesProcessed < MinDataProcessedForCache) {
|
||||
return;
|
||||
}
|
||||
const serializedOutput = this.serializeAddon.serialize();
|
||||
|
2
frontend/types/gotypes.d.ts
vendored
2
frontend/types/gotypes.d.ts
vendored
@ -305,6 +305,7 @@ declare global {
|
||||
"term:theme"?: string;
|
||||
"term:localshellpath"?: string;
|
||||
"term:localshellopts"?: string[];
|
||||
"term:scrollback"?: number;
|
||||
count?: number;
|
||||
};
|
||||
|
||||
@ -423,6 +424,7 @@ declare global {
|
||||
"term:disablewebgl"?: boolean;
|
||||
"term:localshellpath"?: string;
|
||||
"term:localshellopts"?: string[];
|
||||
"term:scrollback"?: number;
|
||||
"editor:minimapenabled"?: boolean;
|
||||
"editor:stickyscrollenabled"?: boolean;
|
||||
"web:*"?: boolean;
|
||||
|
@ -62,6 +62,7 @@ const (
|
||||
MetaKey_TermTheme = "term:theme"
|
||||
MetaKey_TermLocalShellPath = "term:localshellpath"
|
||||
MetaKey_TermLocalShellOpts = "term:localshellopts"
|
||||
MetaKey_TermScrollback = "term:scrollback"
|
||||
|
||||
MetaKey_Count = "count"
|
||||
)
|
||||
|
@ -63,6 +63,7 @@ type MetaTSType struct {
|
||||
TermTheme string `json:"term:theme,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
|
||||
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` // matches settings
|
||||
TermScrollback *int `json:"term:scrollback,omitempty"`
|
||||
|
||||
Count int `json:"count,omitempty"` // temp for cpu plot. will remove later
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ const (
|
||||
ConfigKey_TermDisableWebGl = "term:disablewebgl"
|
||||
ConfigKey_TermLocalShellPath = "term:localshellpath"
|
||||
ConfigKey_TermLocalShellOpts = "term:localshellopts"
|
||||
ConfigKey_TermScrollback = "term:scrollback"
|
||||
|
||||
ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
|
||||
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"
|
||||
|
@ -54,6 +54,7 @@ type SettingsType struct {
|
||||
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
|
||||
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"`
|
||||
TermScrollback *int64 `json:"term:scrollback,omitempty"`
|
||||
|
||||
EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
|
||||
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user