1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05: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.
This commit is contained in:
Simon Tatham
2015-09-01 18:35:38 +01:00
parent ad994bab57
commit 1840103c05
3 changed files with 24 additions and 2 deletions

View File

@ -764,14 +764,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);
}