1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Restore ability to not send SSH terminal modes.

2ce0b680c inadvertently removed this ability in trying to ensure that
everyone got the new IUTF8 mode by default; you could remove a mode from
the list in the UI, but this would just revert PuTTY to its default.

The UI and storage have been revamped; the storage format now explicitly
says when a mode is not to be sent, and the configuration UI always
shows all modes known to PuTTY; if a mode is not to be sent it now shows
up as "(don't send)" in the list.

Old saved settings are migrated so as to preserve previous removals of
longstanding modes, while automatically adding IUTF8.

(In passing, this removes a bug where pressing the 'Remove' button of
the previous UI would populate the value edit box with garbage.)
This commit is contained in:
Jacob Nevins
2017-03-06 10:36:26 +00:00
parent 2ef799da4d
commit 2d0b2e97d0
4 changed files with 137 additions and 108 deletions

21
ssh.c
View File

@ -1036,20 +1036,20 @@ static void parse_ttymodes(Ssh ssh,
int i;
const struct ssh_ttymode *mode;
char *val;
char default_val[2];
strcpy(default_val, "A");
for (i = 0; i < lenof(ssh_ttymodes); i++) {
mode = ssh_ttymodes + i;
val = conf_get_str_str_opt(ssh->conf, CONF_ttymodes, mode->mode);
if (!val)
val = default_val;
/* Every mode known to the current version of the code should be
* mentioned; this was ensured when settings were loaded. */
val = conf_get_str_str(ssh->conf, CONF_ttymodes, mode->mode);
/*
* val[0] is either 'V', indicating that an explicit value
* follows it, or 'A' indicating that we should pass the
* value through from the local environment via get_ttymode.
* val[0] can be
* - 'V', indicating that an explicit value follows it;
* - 'A', indicating that we should pass the value through from
* the local environment via get_ttymode; or
* - 'N', indicating that we should explicitly not send this
* mode.
*/
if (val[0] == 'A') {
val = get_ttymode(ssh->frontend, mode->mode);
@ -1057,8 +1057,9 @@ static void parse_ttymodes(Ssh ssh,
do_mode(data, mode, val);
sfree(val);
}
} else
} else if (val[0] == 'V') {
do_mode(data, mode, val + 1); /* skip the 'V' */
} /* else 'N', or something from the future we don't understand */
}
}