summaryrefslogtreecommitdiffstats
path: root/alacritty_terminal
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-07-28 13:00:55 +0300
committerGitHub <noreply@github.com>2020-07-28 13:00:55 +0300
commit6c4e45f3a69c71958e65fae9a15f82d0c5a27742 (patch)
tree311a32b95b705e9cded8fa2c6f06b297586513fe /alacritty_terminal
parentb7faa9f4378cf922c44f53a8003731fb0de13670 (diff)
Bump minimum supported Rust version to 1.43.0
Diffstat (limited to 'alacritty_terminal')
-rw-r--r--alacritty_terminal/src/event_loop.rs24
-rw-r--r--alacritty_terminal/src/term/mod.rs8
-rw-r--r--alacritty_terminal/src/tty/unix.rs11
-rw-r--r--alacritty_terminal/src/tty/windows/conpty.rs1
-rw-r--r--alacritty_terminal/src/tty/windows/winpty.rs2
5 files changed, 21 insertions, 25 deletions
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs
index 43e8a302..035c1e73 100644
--- a/alacritty_terminal/src/event_loop.rs
+++ b/alacritty_terminal/src/event_loop.rs
@@ -355,26 +355,22 @@ where
|| token == self.pty.write_token() =>
{
#[cfg(unix)]
- {
- if UnixReady::from(event.readiness()).is_hup() {
- // Don't try to do I/O on a dead PTY.
- continue;
- }
+ if UnixReady::from(event.readiness()).is_hup() {
+ // Don't try to do I/O on a dead PTY.
+ continue;
}
if event.readiness().is_readable() {
if let Err(err) = self.pty_read(&mut state, &mut buf, pipe.as_mut())
{
+ // On Linux, a `read` on the master side of a PTY can fail
+ // with `EIO` if the client side hangs up. In that case,
+ // just loop back round for the inevitable `Exited` event.
+ // This sucks, but checking the process is either racy or
+ // blocking.
#[cfg(target_os = "linux")]
- {
- // On Linux, a `read` on the master side of a PTY can fail
- // with `EIO` if the client side hangs up. In that case,
- // just loop back round for the inevitable `Exited` event.
- // This sucks, but checking the process is either racy or
- // blocking.
- if err.kind() == ErrorKind::Other {
- continue;
- }
+ if err.kind() == ErrorKind::Other {
+ continue;
}
error!("Error reading from PTY in event loop: {}", err);
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index ef61ebdf..7a409e2e 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -425,9 +425,11 @@ impl<'a, C> Iterator for RenderableCellsIter<'a, C> {
// Apply cursor color, or invert the cursor if it has a fixed background close
// to the cell's background.
- match self.cursor.cursor_color {
- CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST => (),
- _ => cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg),
+ if !matches!(
+ self.cursor.cursor_color,
+ CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST
+ ) {
+ cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg);
}
return Some(cell);
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index b373ada2..3998d9e6 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -1,6 +1,7 @@
//! TTY related functionality.
use std::borrow::Cow;
+#[cfg(not(target_os = "macos"))]
use std::env;
use std::ffi::CStr;
use std::fs::File;
@@ -148,12 +149,10 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) ->
let (master, slave) = make_pty(size.to_winsize());
#[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);
- }
+ 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 mut buf = [0; 1024];
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs
index fa9f8b5a..b9748c8b 100644
--- a/alacritty_terminal/src/tty/windows/conpty.rs
+++ b/alacritty_terminal/src/tty/windows/conpty.rs
@@ -5,7 +5,6 @@ use std::os::windows::io::IntoRawHandle;
use std::ptr;
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
-use miow;
use winapi::shared::basetsd::{PSIZE_T, SIZE_T};
use winapi::shared::minwindef::{BYTE, DWORD};
use winapi::shared::ntdef::{HANDLE, HRESULT, LPWSTR};
diff --git a/alacritty_terminal/src/tty/windows/winpty.rs b/alacritty_terminal/src/tty/windows/winpty.rs
index 76c4c0b6..f9dd56bb 100644
--- a/alacritty_terminal/src/tty/windows/winpty.rs
+++ b/alacritty_terminal/src/tty/windows/winpty.rs
@@ -34,7 +34,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
SpawnFlags::AUTO_SHUTDOWN | SpawnFlags::EXIT_AFTER_SHUTDOWN,
None, // appname.
Some(&cmdline),
- config.working_directory.as_ref().map(|p| p.as_path()),
+ config.working_directory.as_deref(),
None, // Env.
)
.unwrap();