1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add a Features checkbox to disable bracketed paste mode.

I've had more than one conversation recently in which users have
mentioned finding this mode inconvenient. I don't know whether any of
them would want to turn it off completely, but it seems likely that
_somebody_ will, sooner or later. So here's an option to do that.
This commit is contained in:
Simon Tatham 2024-08-10 12:11:28 +01:00
parent 3c3c179237
commit 6439c93b43
7 changed files with 42 additions and 1 deletions

5
conf.h
View File

@ -903,6 +903,11 @@ CONF_OPTION(no_bidi,
DEFAULT_BOOL(false), DEFAULT_BOOL(false),
SAVE_KEYWORD("DisableBidi"), SAVE_KEYWORD("DisableBidi"),
) )
CONF_OPTION(no_bracketed_paste,
VALUE_TYPE(BOOL),
DEFAULT_BOOL(false),
SAVE_KEYWORD("DisableBracketedPaste"),
)
/* Colour options */ /* Colour options */
CONF_OPTION(ansi_colour, CONF_OPTION(ansi_colour,

View File

@ -2190,6 +2190,9 @@ void setup_config_box(struct controlbox *b, bool midsession,
ctrl_checkbox(s, "Disable bidirectional text display", ctrl_checkbox(s, "Disable bidirectional text display",
'd', HELPCTX(features_bidi), conf_checkbox_handler, 'd', HELPCTX(features_bidi), conf_checkbox_handler,
I(CONF_no_bidi)); I(CONF_no_bidi));
ctrl_checkbox(s, "Disable bracketed paste mode",
'p', HELPCTX(features_bracketed_paste), conf_checkbox_handler,
I(CONF_no_bracketed_paste));
/* /*
* The Window panel. * The Window panel.

View File

@ -984,6 +984,34 @@ right in all situations.
You may also find you need to disable Arabic text shaping; You may also find you need to disable Arabic text shaping;
see \k{config-features-shaping}. see \k{config-features-shaping}.
\S{config-features-bracketed paste} Disabling \i{bracketed paste} mode
By default, when you paste text into the terminal window, it's sent to
the server as terminal input, exactly as if you'd typed the same text
into the terminal window using the keyboard (except that it's all sent
at once, much faster than you could type it).
However, a terminal application can change that, by asking the
terminal to enable \q{bracketed paste mode}. In this mode, pasted data
is marked in the input stream, by sending a special control sequence
before the paste, and another one at the end.
A terminal application can use this information to treat pasted data
differently from keyboard input. For example, a terminal-based text
editor can treat the input as literal data, even if some of its
characters would normally trigger special editor functions. A shell
can treat pasted input as less trusted, in case another application
somehow sneaked a malicious shell command into your clipboard: modern
versions of \cw{bash} will highlight pasted data on the command line,
and not run it until you've confirmed it by pressing Return, even if
the pasted data contained a newline character.
In edge cases, it's possible that bracketed paste mode introduces
bigger problems than the ones it solves. So you can use this checkbox
to turn it off completely. If you do that, then PuTTY will always send
your paste data exactly as if it had been typed at the keyboard,
whether or not the server asked for bracketed paste mode.
\H{config-window} The Window panel \H{config-window} The Window panel
The Window configuration panel allows you to control aspects of the The Window configuration panel allows you to control aspects of the

View File

@ -77,6 +77,8 @@ from other protocols
\IM{copy and paste} cut and paste \IM{copy and paste} cut and paste
\IM{copy and paste} paste, copy and \IM{copy and paste} paste, copy and
\IM{bracketed paste} paste, bracketed
\IM{three-button mouse} three-button mouse \IM{three-button mouse} three-button mouse
\IM{three-button mouse} mouse, three-button \IM{three-button mouse} mouse, three-button

View File

@ -1639,6 +1639,7 @@ static void term_copy_stuff_from_conf(Terminal *term)
term->bellovl_s = conf_get_int(term->conf, CONF_bellovl_s); term->bellovl_s = conf_get_int(term->conf, CONF_bellovl_s);
term->bellovl_t = conf_get_int(term->conf, CONF_bellovl_t); term->bellovl_t = conf_get_int(term->conf, CONF_bellovl_t);
term->no_bidi = conf_get_bool(term->conf, CONF_no_bidi); term->no_bidi = conf_get_bool(term->conf, CONF_no_bidi);
term->no_bracketed_paste = conf_get_bool(term->conf, CONF_no_bracketed_paste);
term->bksp_is_delete = conf_get_bool(term->conf, CONF_bksp_is_delete); term->bksp_is_delete = conf_get_bool(term->conf, CONF_bksp_is_delete);
term->blink_cur = conf_get_bool(term->conf, CONF_blink_cur); term->blink_cur = conf_get_bool(term->conf, CONF_blink_cur);
term->blinktext = conf_get_bool(term->conf, CONF_blinktext); term->blinktext = conf_get_bool(term->conf, CONF_blinktext);
@ -7130,7 +7131,7 @@ void term_do_paste(Terminal *term, const wchar_t *data, int len)
term->paste_pos = term->paste_len = 0; term->paste_pos = term->paste_len = 0;
term->paste_buffer = snewn(len + 12, wchar_t); term->paste_buffer = snewn(len + 12, wchar_t);
if (term->bracketed_paste) if (term->bracketed_paste && !term->no_bracketed_paste)
term_bracketed_paste_start(term); term_bracketed_paste_start(term);
p = data; p = data;

View File

@ -157,6 +157,7 @@ struct terminal_tag {
int raw_mouse_reported_y; int raw_mouse_reported_y;
bool bracketed_paste, bracketed_paste_active; bool bracketed_paste, bracketed_paste_active;
bool no_bracketed_paste; /* disabled in configuration */
int cset_attr[2]; int cset_attr[2];

View File

@ -45,6 +45,7 @@ typedef const char *HelpCtx;
#define WINHELP_CTX_features_clearscroll "config-features-clearscroll" #define WINHELP_CTX_features_clearscroll "config-features-clearscroll"
#define WINHELP_CTX_features_arabicshaping "config-features-shaping" #define WINHELP_CTX_features_arabicshaping "config-features-shaping"
#define WINHELP_CTX_features_bidi "config-features-bidi" #define WINHELP_CTX_features_bidi "config-features-bidi"
#define WINHELP_CTX_features_bracketed_paste "config-features-bracketed-paste"
#define WINHELP_CTX_terminal_autowrap "config-autowrap" #define WINHELP_CTX_terminal_autowrap "config-autowrap"
#define WINHELP_CTX_terminal_decom "config-decom" #define WINHELP_CTX_terminal_decom "config-decom"
#define WINHELP_CTX_terminal_lfhascr "config-crlf" #define WINHELP_CTX_terminal_lfhascr "config-crlf"