Set IUTF8 input setting on supported platforms

Fixes #3769.
This commit is contained in:
Kirill Chibisov 2020-05-27 18:24:01 +03:00 committed by GitHub
parent a14c51797f
commit a669f12793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Don't hide cursor on modifier press with `mouse.hide_when_typing` enabled
- `Shift + Backspace` now sends `^?` instead of `^H`
- Default color scheme is now `Tomorrow Night` with the bright colors of `Tomorrow Night Bright`
- Set IUTF8 termios flag for improved UTF8 input support
### Fixed

View File

@ -22,6 +22,8 @@ use crate::tty::{ChildEvent, EventedPty, EventedReadWrite};
use libc::{self, c_int, pid_t, winsize, TIOCSCTTY};
use log::error;
use nix::pty::openpty;
#[cfg(any(target_os = "linux", target_os = "macos"))]
use nix::sys::termios::{self, InputFlags, SetArg};
use signal_hook::{self as sighook, iterator::Signals};
use mio::unix::EventedFd;
@ -45,7 +47,7 @@ static PID: AtomicUsize = AtomicUsize::new(0);
macro_rules! die {
($($arg:tt)*) => {{
error!($($arg)*);
::std::process::exit(1);
std::process::exit(1);
}}
}
@ -148,6 +150,15 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) ->
let (master, slave) = make_pty(win_size);
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
if let Ok(mut termios) = termios::tcgetattr(master) {
// Set character encoding to UTF-8.
termios.input_flags.set(InputFlags::IUTF8, true);
let _ = termios::tcsetattr(master, SetArg::TCSANOW, &termios);
}
}
let default_shell = if cfg!(target_os = "macos") {
let shell_name = pw.shell.rsplit('/').next().unwrap();
let argv = vec![String::from("-c"), format!("exec -a -{} {}", shell_name, pw.shell)];