mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
pterm: set IUTF8 on pty devices depending on charset.
In a UTF-8 pterm, it makes sense to set the IUTF8 flag (on systems
that have one) on the pty device, so that line editing will take
account of UTF-8 multibyte characters.
(cherry picked from commit 1840103c05
)
This commit is contained in:
parent
14464764da
commit
eb319f9b6e
@ -2914,6 +2914,12 @@ void uxsel_input_remove(int id) {
|
||||
gdk_input_remove(id);
|
||||
}
|
||||
|
||||
int frontend_is_utf8(void *frontend)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)frontend;
|
||||
return inst->ucsdata.line_codepage == CS_UTF8;
|
||||
}
|
||||
|
||||
char *setup_fonts_ucs(struct gui_data *inst)
|
||||
{
|
||||
int shadowbold = conf_get_int(inst->conf, CONF_shadowbold);
|
||||
|
@ -77,6 +77,7 @@ unsigned long getticks(void); /* based on gettimeofday(2) */
|
||||
char *get_x_display(void *frontend);
|
||||
int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
|
||||
long get_windowid(void *frontend);
|
||||
int frontend_is_utf8(void *frontend);
|
||||
|
||||
/* Things gtkdlg.c needs from pterm.c */
|
||||
void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
|
||||
|
19
unix/uxpty.c
19
unix/uxpty.c
@ -738,14 +738,29 @@ static const char *pty_init(void *frontend, void **backend_handle, Conf *conf,
|
||||
pty_open_master(pty);
|
||||
|
||||
/*
|
||||
* Set the backspace character to be whichever of ^H and ^? is
|
||||
* specified by bksp_is_delete.
|
||||
* Set up configuration-dependent termios settings on the new pty.
|
||||
*/
|
||||
{
|
||||
struct termios attrs;
|
||||
tcgetattr(pty->master_fd, &attrs);
|
||||
|
||||
/*
|
||||
* Set the backspace character to be whichever of ^H and ^? is
|
||||
* specified by bksp_is_delete.
|
||||
*/
|
||||
attrs.c_cc[VERASE] = conf_get_int(conf, CONF_bksp_is_delete)
|
||||
? '\177' : '\010';
|
||||
|
||||
/*
|
||||
* Set the IUTF8 bit iff the character set is UTF-8.
|
||||
*/
|
||||
#ifdef IUTF8
|
||||
if (frontend_is_utf8(frontend))
|
||||
attrs.c_iflag |= IUTF8;
|
||||
else
|
||||
attrs.c_iflag &= ~IUTF8;
|
||||
#endif
|
||||
|
||||
tcsetattr(pty->master_fd, TCSANOW, &attrs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user