diff --git a/docs/docs/config.mdx b/docs/docs/config.mdx index 4c2f8d4926..8275b0b02e 100644 --- a/docs/docs/config.mdx +++ b/docs/docs/config.mdx @@ -47,6 +47,7 @@ wsh editconfig | term:scrollback | int | size of terminal scrollback buffer, max is 10000 | | term:theme | string | preset name of terminal theme to apply by default (default is "default-dark") | | term:transparency | float64 | set the background transparency of terminal theme (default 0.5, 0 = not transparent, 1.0 = fully transparent) | +| term:allowbracketedpaste | bool | allow bracketed paste mode in terminal (default false) | | editor:minimapenabled | bool | set to false to disable editor minimap | | editor:stickyscrollenabled | bool | enables monaco editor's stickyScroll feature (pinning headers of current context, e.g. class names, method names, etc.), defaults to false | | editor:wordwrap | bool | set to true to enable word wrapping in the editor (defaults to false) | diff --git a/frontend/app/view/term/term.tsx b/frontend/app/view/term/term.tsx index a6f8c17339..f79cd8c6c3 100644 --- a/frontend/app/view/term/term.tsx +++ b/frontend/app/view/term/term.tsx @@ -927,6 +927,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => { const fullConfig = globalStore.get(atoms.fullConfigAtom); const termThemeName = globalStore.get(model.termThemeNameAtom); const termTransparency = globalStore.get(model.termTransparencyAtom); + const termBPMAtom = getOverrideConfigAtom(blockId, "term:allowbracketedpaste"); const [termTheme, _] = computeTheme(fullConfig, termThemeName, termTransparency); let termScrollback = 1000; if (termSettings?.["term:scrollback"]) { @@ -941,6 +942,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => { if (termScrollback > 10000) { termScrollback = 10000; } + const termAllowBPM = globalStore.get(termBPMAtom) ?? false; const wasFocused = model.termRef.current != null && globalStore.get(model.nodeModel.isFocused); const termWrap = new TermWrap( blockId, @@ -955,6 +957,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => { allowTransparency: true, scrollback: termScrollback, allowProposedApi: true, // Required by @xterm/addon-search to enable search functionality and decorations + ignoreBracketedPasteMode: !termAllowBPM, }, { keydownHandler: model.handleTerminalKeydown.bind(model), diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 6822751344..4354af5cdc 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -493,6 +493,7 @@ declare global { "term:vdomblockid"?: string; "term:vdomtoolbarblockid"?: string; "term:transparency"?: number; + "term:allowbracketedpaste"?: boolean; "web:zoom"?: number; "web:hidenav"?: boolean; "markdown:fontsize"?: number; @@ -599,6 +600,7 @@ declare global { "term:scrollback"?: number; "term:copyonselect"?: boolean; "term:transparency"?: number; + "term:allowbracketedpaste"?: boolean; "editor:minimapenabled"?: boolean; "editor:stickyscrollenabled"?: boolean; "editor:wordwrap"?: boolean; diff --git a/pkg/waveobj/metaconsts.go b/pkg/waveobj/metaconsts.go index a70eea5f5c..9e3a81ec97 100644 --- a/pkg/waveobj/metaconsts.go +++ b/pkg/waveobj/metaconsts.go @@ -94,6 +94,7 @@ const ( MetaKey_TermVDomSubBlockId = "term:vdomblockid" MetaKey_TermVDomToolbarBlockId = "term:vdomtoolbarblockid" MetaKey_TermTransparency = "term:transparency" + MetaKey_TermAllowBracketedPaste = "term:allowbracketedpaste" MetaKey_WebZoom = "web:zoom" MetaKey_WebHideNav = "web:hidenav" diff --git a/pkg/waveobj/wtypemeta.go b/pkg/waveobj/wtypemeta.go index 948741dd6a..49aa5a2593 100644 --- a/pkg/waveobj/wtypemeta.go +++ b/pkg/waveobj/wtypemeta.go @@ -84,17 +84,18 @@ type MetaTSType struct { BgBorderColor string `json:"bg:bordercolor,omitempty"` // frame:bordercolor BgActiveBorderColor string `json:"bg:activebordercolor,omitempty"` // frame:activebordercolor - TermClear bool `json:"term:*,omitempty"` - TermFontSize int `json:"term:fontsize,omitempty"` - TermFontFamily string `json:"term:fontfamily,omitempty"` - TermMode string `json:"term:mode,omitempty"` - 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"` - TermVDomSubBlockId string `json:"term:vdomblockid,omitempty"` - TermVDomToolbarBlockId string `json:"term:vdomtoolbarblockid,omitempty"` - TermTransparency *float64 `json:"term:transparency,omitempty"` // default 0.5 + TermClear bool `json:"term:*,omitempty"` + TermFontSize int `json:"term:fontsize,omitempty"` + TermFontFamily string `json:"term:fontfamily,omitempty"` + TermMode string `json:"term:mode,omitempty"` + 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"` + TermVDomSubBlockId string `json:"term:vdomblockid,omitempty"` + TermVDomToolbarBlockId string `json:"term:vdomtoolbarblockid,omitempty"` + TermTransparency *float64 `json:"term:transparency,omitempty"` // default 0.5 + TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"` WebZoom float64 `json:"web:zoom,omitempty"` WebHideNav *bool `json:"web:hidenav,omitempty"` diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index 27693b2b4c..4e95a33734 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -34,6 +34,7 @@ const ( ConfigKey_TermScrollback = "term:scrollback" ConfigKey_TermCopyOnSelect = "term:copyonselect" ConfigKey_TermTransparency = "term:transparency" + ConfigKey_TermAllowBracketedPaste = "term:allowbracketedpaste" ConfigKey_EditorMinimapEnabled = "editor:minimapenabled" ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 859c2d426e..354975b786 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -51,16 +51,17 @@ type SettingsType struct { AiFontSize float64 `json:"ai:fontsize,omitempty"` AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"` - TermClear bool `json:"term:*,omitempty"` - TermFontSize float64 `json:"term:fontsize,omitempty"` - TermFontFamily string `json:"term:fontfamily,omitempty"` - TermTheme string `json:"term:theme,omitempty"` - TermDisableWebGl bool `json:"term:disablewebgl,omitempty"` - TermLocalShellPath string `json:"term:localshellpath,omitempty"` - TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` - TermScrollback *int64 `json:"term:scrollback,omitempty"` - TermCopyOnSelect *bool `json:"term:copyonselect,omitempty"` - TermTransparency *float64 `json:"term:transparency,omitempty"` + TermClear bool `json:"term:*,omitempty"` + TermFontSize float64 `json:"term:fontsize,omitempty"` + TermFontFamily string `json:"term:fontfamily,omitempty"` + TermTheme string `json:"term:theme,omitempty"` + TermDisableWebGl bool `json:"term:disablewebgl,omitempty"` + TermLocalShellPath string `json:"term:localshellpath,omitempty"` + TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` + TermScrollback *int64 `json:"term:scrollback,omitempty"` + TermCopyOnSelect *bool `json:"term:copyonselect,omitempty"` + TermTransparency *float64 `json:"term:transparency,omitempty"` + TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"` EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"` EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`