config: add clipboard-paste-bracketed-safe

This commit is contained in:
Mitchell Hashimoto
2023-11-05 09:25:06 -08:00
parent f521b0cb99
commit 705f3b52c7
2 changed files with 9 additions and 1 deletions

View File

@ -143,6 +143,7 @@ const DerivedConfig = struct {
clipboard_write: bool,
clipboard_trim_trailing_spaces: bool,
clipboard_paste_protection: bool,
clipboard_paste_bracketed_safe: bool,
copy_on_select: configpkg.CopyOnSelect,
confirm_close_surface: bool,
mouse_interval: u64,
@ -167,6 +168,7 @@ const DerivedConfig = struct {
.clipboard_write = config.@"clipboard-write",
.clipboard_trim_trailing_spaces = config.@"clipboard-trim-trailing-spaces",
.clipboard_paste_protection = config.@"clipboard-paste-protection",
.clipboard_paste_bracketed_safe = config.@"clipboard-paste-bracketed-safe",
.copy_on_select = config.@"copy-on-select",
.confirm_close_surface = config.@"confirm-close-surface",
.mouse_interval = config.@"click-repeat-interval" * 1_000_000, // 500ms
@ -2514,7 +2516,7 @@ fn completeClipboardPaste(
//
// We do not do this for bracketed pastes because bracketed pastes are
// by definition safe since they're framed.
if (!bracketed and
if ((!self.config.clipboard_paste_bracketed_safe or !bracketed) and
self.config.clipboard_paste_protection and
!allow_unsafe and
!terminal.isSafePaste(data))

View File

@ -430,6 +430,12 @@ keybind: Keybinds = .{},
/// This currently only works on Linux (GTK).
@"clipboard-paste-protection": bool = true,
/// If true, bracketed pastes will be considered safe. By default,
/// bracketed pastes are considered safe. "Bracketed" pastes are pastes
/// while the running program has bracketed paste mode enabled (a setting
/// set by the running program, not the terminal emulator).
@"clipboard-paste-bracketed-safe": bool = true,
/// The total amount of bytes that can be used for image data (i.e.
/// the Kitty image protocol) per terminal scren. The maximum value
/// is 4,294,967,295 (4GB). The default is 320MB. If this is set to zero,