mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Add UTF-8 versions of dlg_editbox_{get,set}.
There's no difficulty with implementing these, on either platform. Windows has native Unicode support for its edit boxes: we can set and retrieve the text as a wide-character string, and then converting it to and from UTF-8 is easy. And GTK has specified its edit boxes as being UTF-8 all along, no matter what the system locale.
This commit is contained in:
@ -300,7 +300,7 @@ bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->toplevel));
|
||||
}
|
||||
|
||||
void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||
void dlg_editbox_set_utf8(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||
{
|
||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||
GtkWidget *entry;
|
||||
@ -338,7 +338,14 @@ void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||
sfree(tmpstring);
|
||||
}
|
||||
|
||||
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||
void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||
{
|
||||
/* GTK specifies that its edit boxes are always in UTF-8 anyway,
|
||||
* so legacy behaviour is to use those strings unmodified */
|
||||
dlg_editbox_set_utf8(ctrl, dp, text);
|
||||
}
|
||||
|
||||
char *dlg_editbox_get_utf8(dlgcontrol *ctrl, dlgparam *dp)
|
||||
{
|
||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||
assert(uc->ctrl->type == CTRL_EDITBOX);
|
||||
@ -357,6 +364,13 @@ char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||
unreachable("bad control type in editbox_get");
|
||||
}
|
||||
|
||||
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||
{
|
||||
/* GTK specifies that its edit boxes are always in UTF-8 anyway,
|
||||
* so legacy behaviour is to use those strings unmodified */
|
||||
return dlg_editbox_get_utf8(ctrl, dp);
|
||||
}
|
||||
|
||||
void dlg_editbox_select_range(dlgcontrol *ctrl, dlgparam *dp,
|
||||
size_t start, size_t len)
|
||||
{
|
||||
|
Reference in New Issue
Block a user