From 705f3b52c771c6b16f05f1e24a2b03ba476ec2d1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Nov 2023 09:25:06 -0800 Subject: [PATCH] config: add clipboard-paste-bracketed-safe --- src/Surface.zig | 4 +++- src/config/Config.zig | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Surface.zig b/src/Surface.zig index 0e4bb47a4..7032ec8ae 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -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)) diff --git a/src/config/Config.zig b/src/config/Config.zig index fbb92e5ba..0e368c390 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -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,