summaryrefslogtreecommitdiffstats
path: root/alacritty_terminal
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-05-27 18:24:01 +0300
committerGitHub <noreply@github.com>2020-05-27 18:24:01 +0300
commita669f12793779fdb5a5b7c455c5b458c0f9a4dfc (patch)
tree52a332ec006183af05e469fbafca5ffc0f893cfd /alacritty_terminal
parenta14c51797f39356cf75dc8012c3a3ff3d63c042f (diff)
Set IUTF8 input setting on supported platforms
Fixes #3769.
Diffstat (limited to 'alacritty_terminal')
-rw-r--r--alacritty_terminal/src/tty/unix.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index f2753089..2db59519 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -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)];