Skip to content

Commit 55f0373

Browse files
authored
add term:allowbracketedpaste, default false (#1688)
1 parent b51ff83 commit 55f0373

7 files changed

Lines changed: 31 additions & 21 deletions

File tree

docs/docs/config.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ wsh editconfig
4747
| term:scrollback | int | size of terminal scrollback buffer, max is 10000 |
4848
| term:theme | string | preset name of terminal theme to apply by default (default is "default-dark") |
4949
| term:transparency | float64 | set the background transparency of terminal theme (default 0.5, 0 = not transparent, 1.0 = fully transparent) |
50+
| term:allowbracketedpaste | bool | allow bracketed paste mode in terminal (default false) |
5051
| editor:minimapenabled | bool | set to false to disable editor minimap |
5152
| editor:stickyscrollenabled | bool | enables monaco editor's stickyScroll feature (pinning headers of current context, e.g. class names, method names, etc.), defaults to false |
5253
| editor:wordwrap | bool | set to true to enable word wrapping in the editor (defaults to false) |

frontend/app/view/term/term.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
927927
const fullConfig = globalStore.get(atoms.fullConfigAtom);
928928
const termThemeName = globalStore.get(model.termThemeNameAtom);
929929
const termTransparency = globalStore.get(model.termTransparencyAtom);
930+
const termBPMAtom = getOverrideConfigAtom(blockId, "term:allowbracketedpaste");
930931
const [termTheme, _] = computeTheme(fullConfig, termThemeName, termTransparency);
931932
let termScrollback = 1000;
932933
if (termSettings?.["term:scrollback"]) {
@@ -941,6 +942,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
941942
if (termScrollback > 10000) {
942943
termScrollback = 10000;
943944
}
945+
const termAllowBPM = globalStore.get(termBPMAtom) ?? false;
944946
const wasFocused = model.termRef.current != null && globalStore.get(model.nodeModel.isFocused);
945947
const termWrap = new TermWrap(
946948
blockId,
@@ -955,6 +957,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => {
955957
allowTransparency: true,
956958
scrollback: termScrollback,
957959
allowProposedApi: true, // Required by @xterm/addon-search to enable search functionality and decorations
960+
ignoreBracketedPasteMode: !termAllowBPM,
958961
},
959962
{
960963
keydownHandler: model.handleTerminalKeydown.bind(model),

frontend/types/gotypes.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ declare global {
493493
"term:vdomblockid"?: string;
494494
"term:vdomtoolbarblockid"?: string;
495495
"term:transparency"?: number;
496+
"term:allowbracketedpaste"?: boolean;
496497
"web:zoom"?: number;
497498
"web:hidenav"?: boolean;
498499
"markdown:fontsize"?: number;
@@ -599,6 +600,7 @@ declare global {
599600
"term:scrollback"?: number;
600601
"term:copyonselect"?: boolean;
601602
"term:transparency"?: number;
603+
"term:allowbracketedpaste"?: boolean;
602604
"editor:minimapenabled"?: boolean;
603605
"editor:stickyscrollenabled"?: boolean;
604606
"editor:wordwrap"?: boolean;

pkg/waveobj/metaconsts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const (
9494
MetaKey_TermVDomSubBlockId = "term:vdomblockid"
9595
MetaKey_TermVDomToolbarBlockId = "term:vdomtoolbarblockid"
9696
MetaKey_TermTransparency = "term:transparency"
97+
MetaKey_TermAllowBracketedPaste = "term:allowbracketedpaste"
9798

9899
MetaKey_WebZoom = "web:zoom"
99100
MetaKey_WebHideNav = "web:hidenav"

pkg/waveobj/wtypemeta.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,18 @@ type MetaTSType struct {
8484
BgBorderColor string `json:"bg:bordercolor,omitempty"` // frame:bordercolor
8585
BgActiveBorderColor string `json:"bg:activebordercolor,omitempty"` // frame:activebordercolor
8686

87-
TermClear bool `json:"term:*,omitempty"`
88-
TermFontSize int `json:"term:fontsize,omitempty"`
89-
TermFontFamily string `json:"term:fontfamily,omitempty"`
90-
TermMode string `json:"term:mode,omitempty"`
91-
TermTheme string `json:"term:theme,omitempty"`
92-
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
93-
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` // matches settings
94-
TermScrollback *int `json:"term:scrollback,omitempty"`
95-
TermVDomSubBlockId string `json:"term:vdomblockid,omitempty"`
96-
TermVDomToolbarBlockId string `json:"term:vdomtoolbarblockid,omitempty"`
97-
TermTransparency *float64 `json:"term:transparency,omitempty"` // default 0.5
87+
TermClear bool `json:"term:*,omitempty"`
88+
TermFontSize int `json:"term:fontsize,omitempty"`
89+
TermFontFamily string `json:"term:fontfamily,omitempty"`
90+
TermMode string `json:"term:mode,omitempty"`
91+
TermTheme string `json:"term:theme,omitempty"`
92+
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
93+
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` // matches settings
94+
TermScrollback *int `json:"term:scrollback,omitempty"`
95+
TermVDomSubBlockId string `json:"term:vdomblockid,omitempty"`
96+
TermVDomToolbarBlockId string `json:"term:vdomtoolbarblockid,omitempty"`
97+
TermTransparency *float64 `json:"term:transparency,omitempty"` // default 0.5
98+
TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"`
9899

99100
WebZoom float64 `json:"web:zoom,omitempty"`
100101
WebHideNav *bool `json:"web:hidenav,omitempty"`

pkg/wconfig/metaconsts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
ConfigKey_TermScrollback = "term:scrollback"
3535
ConfigKey_TermCopyOnSelect = "term:copyonselect"
3636
ConfigKey_TermTransparency = "term:transparency"
37+
ConfigKey_TermAllowBracketedPaste = "term:allowbracketedpaste"
3738

3839
ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
3940
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"

pkg/wconfig/settingsconfig.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,17 @@ type SettingsType struct {
5151
AiFontSize float64 `json:"ai:fontsize,omitempty"`
5252
AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"`
5353

54-
TermClear bool `json:"term:*,omitempty"`
55-
TermFontSize float64 `json:"term:fontsize,omitempty"`
56-
TermFontFamily string `json:"term:fontfamily,omitempty"`
57-
TermTheme string `json:"term:theme,omitempty"`
58-
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
59-
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
60-
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"`
61-
TermScrollback *int64 `json:"term:scrollback,omitempty"`
62-
TermCopyOnSelect *bool `json:"term:copyonselect,omitempty"`
63-
TermTransparency *float64 `json:"term:transparency,omitempty"`
54+
TermClear bool `json:"term:*,omitempty"`
55+
TermFontSize float64 `json:"term:fontsize,omitempty"`
56+
TermFontFamily string `json:"term:fontfamily,omitempty"`
57+
TermTheme string `json:"term:theme,omitempty"`
58+
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
59+
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
60+
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"`
61+
TermScrollback *int64 `json:"term:scrollback,omitempty"`
62+
TermCopyOnSelect *bool `json:"term:copyonselect,omitempty"`
63+
TermTransparency *float64 `json:"term:transparency,omitempty"`
64+
TermAllowBracketedPaste *bool `json:"term:allowbracketedpaste,omitempty"`
6465

6566
EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
6667
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`

0 commit comments

Comments
 (0)