mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +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:
parent
3c3c179237
commit
6439c93b43
5
conf.h
5
conf.h
@ -903,6 +903,11 @@ CONF_OPTION(no_bidi,
|
||||
DEFAULT_BOOL(false),
|
||||
SAVE_KEYWORD("DisableBidi"),
|
||||
)
|
||||
CONF_OPTION(no_bracketed_paste,
|
||||
VALUE_TYPE(BOOL),
|
||||
DEFAULT_BOOL(false),
|
||||
SAVE_KEYWORD("DisableBracketedPaste"),
|
||||
)
|
||||
|
||||
/* Colour options */
|
||||
CONF_OPTION(ansi_colour,
|
||||
|
3
config.c
3
config.c
@ -2190,6 +2190,9 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ctrl_checkbox(s, "Disable bidirectional text display",
|
||||
'd', HELPCTX(features_bidi), conf_checkbox_handler,
|
||||
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.
|
||||
|
@ -984,6 +984,34 @@ right in all situations.
|
||||
You may also find you need to disable Arabic text 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
|
||||
|
||||
The Window configuration panel allows you to control aspects of the
|
||||
|
@ -77,6 +77,8 @@ from other protocols
|
||||
\IM{copy and paste} cut and paste
|
||||
\IM{copy and paste} paste, copy and
|
||||
|
||||
\IM{bracketed paste} paste, bracketed
|
||||
|
||||
\IM{three-button mouse} three-button mouse
|
||||
\IM{three-button mouse} mouse, three-button
|
||||
|
||||
|
@ -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_t = conf_get_int(term->conf, CONF_bellovl_t);
|
||||
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->blink_cur = conf_get_bool(term->conf, CONF_blink_cur);
|
||||
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_buffer = snewn(len + 12, wchar_t);
|
||||
|
||||
if (term->bracketed_paste)
|
||||
if (term->bracketed_paste && !term->no_bracketed_paste)
|
||||
term_bracketed_paste_start(term);
|
||||
|
||||
p = data;
|
||||
|
@ -157,6 +157,7 @@ struct terminal_tag {
|
||||
int raw_mouse_reported_y;
|
||||
|
||||
bool bracketed_paste, bracketed_paste_active;
|
||||
bool no_bracketed_paste; /* disabled in configuration */
|
||||
|
||||
int cset_attr[2];
|
||||
|
||||
|
@ -45,6 +45,7 @@ typedef const char *HelpCtx;
|
||||
#define WINHELP_CTX_features_clearscroll "config-features-clearscroll"
|
||||
#define WINHELP_CTX_features_arabicshaping "config-features-shaping"
|
||||
#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_decom "config-decom"
|
||||
#define WINHELP_CTX_terminal_lfhascr "config-crlf"
|
||||
|
Loading…
Reference in New Issue
Block a user