1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-02-03 21:52:24 +00:00

Make ESC[3J (clear scrollback) a disableable escape sequence.

A user complained that it was being done nonconsensually, and it seems
reasonable that the user should have the choice to prevent it.
This commit is contained in:
Simon Tatham 2016-11-17 20:25:27 +00:00
parent 5c390fceab
commit fa91b55eec
7 changed files with 21 additions and 1 deletions

View File

@ -1690,6 +1690,10 @@ void setup_config_box(struct controlbox *b, int midsession,
HELPCTX(features_retitle), HELPCTX(features_retitle),
conf_checkbox_handler, conf_checkbox_handler,
I(CONF_no_remote_wintitle)); I(CONF_no_remote_wintitle));
ctrl_checkbox(s, "Disable remote-controlled clearing of scrollback", 'e',
HELPCTX(features_clearscroll),
conf_checkbox_handler,
I(CONF_no_remote_clearscroll));
ctrl_radiobuttons(s, "Response to remote title query (SECURITY):", 'q', 3, ctrl_radiobuttons(s, "Response to remote title query (SECURITY):", 'q', 3,
HELPCTX(features_qtitle), HELPCTX(features_qtitle),
conf_radiobutton_handler, conf_radiobutton_handler,

View File

@ -934,6 +934,15 @@ setting you want if you have no better ideas.
\dd PuTTY responds with the actual window title. This is dangerous for \dd PuTTY responds with the actual window title. This is dangerous for
the reasons described above. the reasons described above.
\S{config-features-clearscroll} Disabling remote \i{scrollback clearing}
\cfg{winhelp-topic}{features.clearscroll}
PuTTY has the ability to clear the terminal's scrollback buffer in
response to a command from the server. If you find PuTTY is doing this
unexpectedly or inconveniently, you can tell PuTTY not to respond to
that server command.
\S{config-features-dbackspace} Disabling \i{destructive backspace} \S{config-features-dbackspace} Disabling \i{destructive backspace}
\cfg{winhelp-topic}{features.dbackspace} \cfg{winhelp-topic}{features.dbackspace}

View File

@ -770,6 +770,7 @@ void cleanup_exit(int);
X(INT, NONE, no_remote_resize) /* disable remote resizing */ \ X(INT, NONE, no_remote_resize) /* disable remote resizing */ \
X(INT, NONE, no_alt_screen) /* disable alternate screen */ \ X(INT, NONE, no_alt_screen) /* disable alternate screen */ \
X(INT, NONE, no_remote_wintitle) /* disable remote retitling */ \ X(INT, NONE, no_remote_wintitle) /* disable remote retitling */ \
X(INT, NONE, no_remote_clearscroll) /* disable ESC[3J */ \
X(INT, NONE, no_dbackspace) /* disable destructive backspace */ \ X(INT, NONE, no_dbackspace) /* disable destructive backspace */ \
X(INT, NONE, no_remote_charset) /* disable remote charset config */ \ X(INT, NONE, no_remote_charset) /* disable remote charset config */ \
X(INT, NONE, remote_qtitle_action) /* remote win title query action */ \ X(INT, NONE, remote_qtitle_action) /* remote win title query action */ \

View File

@ -545,6 +545,7 @@ void save_open_settings(void *sesskey, Conf *conf)
write_setting_i(sesskey, "NoRemoteResize", conf_get_int(conf, CONF_no_remote_resize)); write_setting_i(sesskey, "NoRemoteResize", conf_get_int(conf, CONF_no_remote_resize));
write_setting_i(sesskey, "NoAltScreen", conf_get_int(conf, CONF_no_alt_screen)); write_setting_i(sesskey, "NoAltScreen", conf_get_int(conf, CONF_no_alt_screen));
write_setting_i(sesskey, "NoRemoteWinTitle", conf_get_int(conf, CONF_no_remote_wintitle)); write_setting_i(sesskey, "NoRemoteWinTitle", conf_get_int(conf, CONF_no_remote_wintitle));
write_setting_i(sesskey, "NoRemoteClearScroll", conf_get_int(conf, CONF_no_remote_clearscroll));
write_setting_i(sesskey, "RemoteQTitleAction", conf_get_int(conf, CONF_remote_qtitle_action)); write_setting_i(sesskey, "RemoteQTitleAction", conf_get_int(conf, CONF_remote_qtitle_action));
write_setting_i(sesskey, "NoDBackspace", conf_get_int(conf, CONF_no_dbackspace)); write_setting_i(sesskey, "NoDBackspace", conf_get_int(conf, CONF_no_dbackspace));
write_setting_i(sesskey, "NoRemoteCharset", conf_get_int(conf, CONF_no_remote_charset)); write_setting_i(sesskey, "NoRemoteCharset", conf_get_int(conf, CONF_no_remote_charset));
@ -876,6 +877,7 @@ void load_open_settings(void *sesskey, Conf *conf)
gppi(sesskey, "NoRemoteResize", 0, conf, CONF_no_remote_resize); gppi(sesskey, "NoRemoteResize", 0, conf, CONF_no_remote_resize);
gppi(sesskey, "NoAltScreen", 0, conf, CONF_no_alt_screen); gppi(sesskey, "NoAltScreen", 0, conf, CONF_no_alt_screen);
gppi(sesskey, "NoRemoteWinTitle", 0, conf, CONF_no_remote_wintitle); gppi(sesskey, "NoRemoteWinTitle", 0, conf, CONF_no_remote_wintitle);
gppi(sesskey, "NoRemoteClearScroll", 0, conf, CONF_no_remote_clearscroll);
{ {
/* Backward compatibility */ /* Backward compatibility */
int no_remote_qtitle = gppi_raw(sesskey, "NoRemoteQTitle", 1); int no_remote_qtitle = gppi_raw(sesskey, "NoRemoteQTitle", 1);

View File

@ -1403,6 +1403,7 @@ void term_copy_stuff_from_conf(Terminal *term)
term->no_remote_charset = conf_get_int(term->conf, CONF_no_remote_charset); term->no_remote_charset = conf_get_int(term->conf, CONF_no_remote_charset);
term->no_remote_resize = conf_get_int(term->conf, CONF_no_remote_resize); term->no_remote_resize = conf_get_int(term->conf, CONF_no_remote_resize);
term->no_remote_wintitle = conf_get_int(term->conf, CONF_no_remote_wintitle); term->no_remote_wintitle = conf_get_int(term->conf, CONF_no_remote_wintitle);
term->no_remote_clearscroll = conf_get_int(term->conf, CONF_no_remote_clearscroll);
term->rawcnp = conf_get_int(term->conf, CONF_rawcnp); term->rawcnp = conf_get_int(term->conf, CONF_rawcnp);
term->rect_select = conf_get_int(term->conf, CONF_rect_select); term->rect_select = conf_get_int(term->conf, CONF_rect_select);
term->remote_qtitle_action = conf_get_int(term->conf, CONF_remote_qtitle_action); term->remote_qtitle_action = conf_get_int(term->conf, CONF_remote_qtitle_action);
@ -3606,6 +3607,7 @@ static void term_out(Terminal *term)
if (i == 3) { if (i == 3) {
/* Erase Saved Lines (xterm) /* Erase Saved Lines (xterm)
* This follows Thomas Dickey's xterm. */ * This follows Thomas Dickey's xterm. */
if (!term->no_remote_clearscroll)
term_clrsb(term); term_clrsb(term);
} else { } else {
i++; i++;

View File

@ -315,6 +315,7 @@ struct terminal_tag {
int no_remote_charset; int no_remote_charset;
int no_remote_resize; int no_remote_resize;
int no_remote_wintitle; int no_remote_wintitle;
int no_remote_clearscroll;
int rawcnp; int rawcnp;
int rect_select; int rect_select;
int remote_qtitle_action; int remote_qtitle_action;

View File

@ -41,6 +41,7 @@
#define WINHELP_CTX_features_qtitle "features.qtitle:config-features-qtitle" #define WINHELP_CTX_features_qtitle "features.qtitle:config-features-qtitle"
#define WINHELP_CTX_features_dbackspace "features.dbackspace:config-features-dbackspace" #define WINHELP_CTX_features_dbackspace "features.dbackspace:config-features-dbackspace"
#define WINHELP_CTX_features_charset "features.charset:config-features-charset" #define WINHELP_CTX_features_charset "features.charset:config-features-charset"
#define WINHELP_CTX_features_clearscroll "features.clearscroll:config-features-clearscroll"
#define WINHELP_CTX_features_arabicshaping "features.arabicshaping:config-features-shaping" #define WINHELP_CTX_features_arabicshaping "features.arabicshaping:config-features-shaping"
#define WINHELP_CTX_features_bidi "features.bidi:config-features-bidi" #define WINHELP_CTX_features_bidi "features.bidi:config-features-bidi"
#define WINHELP_CTX_terminal_autowrap "terminal.autowrap:config-autowrap" #define WINHELP_CTX_terminal_autowrap "terminal.autowrap:config-autowrap"