diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-05-27 18:24:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 18:24:01 +0300 |
commit | a669f12793779fdb5a5b7c455c5b458c0f9a4dfc (patch) | |
tree | 52a332ec006183af05e469fbafca5ffc0f893cfd | |
parent | a14c51797f39356cf75dc8012c3a3ff3d63c042f (diff) | |
download | alacritty-a669f12793779fdb5a5b7c455c5b458c0f9a4dfc.tar.gz alacritty-a669f12793779fdb5a5b7c455c5b458c0f9a4dfc.zip |
Set IUTF8 input setting on supported platforms
Fixes #3769.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/unix.rs | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bf496480..9078db18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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)]; |