1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-28 01:07:08 -05:00

conf_editbox_handler: support the new string types.

Now you can use an ordinary edit box in the config setup to talk to a
string-valued Conf setting typed as any of CONF_TYPE_STR,
CONF_TYPE_UTF8 or CONF_TYPE_STR_AMBI.
This commit is contained in:
Simon Tatham 2024-09-23 16:55:44 +01:00
parent 55d413a47a
commit dc4ac7c4e1

View File

@ -122,11 +122,19 @@ void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg,
if (type->type == EDIT_STR) {
if (event == EVENT_REFRESH) {
char *field = conf_get_str(conf, key);
dlg_editbox_set(ctrl, dlg, field);
bool utf8;
char *field = conf_get_str_ambi(conf, key, &utf8);
if (utf8)
dlg_editbox_set_utf8(ctrl, dlg, field);
else
dlg_editbox_set(ctrl, dlg, field);
} else if (event == EVENT_VALCHANGE) {
char *field = dlg_editbox_get(ctrl, dlg);
conf_set_str(conf, key, field);
char *field = dlg_editbox_get_utf8(ctrl, dlg);
if (!conf_try_set_utf8(conf, key, field)) {
sfree(field);
field = dlg_editbox_get(ctrl, dlg);
conf_set_str(conf, key, field);
}
sfree(field);
}
} else {