Upgrade alacritty_terminal in hopes to avoid PTY poll failing

We saw stack traces in our #panic channel pop up that failed on this line:

    3330614219/alacritty_terminal/src/event_loop.rs (L323-L324)

With this message:

    thread 'PTY reader' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" }'
    /Users/administrator/.cargo/git/checkouts/alacritty-afea874b09a502a5/3330614/alacritty_terminal/src/event_loop.rs:324

We don't know how to reproduce the error. It doesn't seem related to the number of open PTY handles,
because `openpty` itself didn't fail. We can only assume that something went wrong between
`openpty` and the setup of the polling.

Since Alacritty itself changed its polling mechanism significantly by switching
from `mio` to `polling` (https://github.com/alacritty/alacritty/pull/6846) we upgraded
with the hope that this will fix the bug.

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Federico <code@fdionisi.me>
Co-authored-by: David <dammerung2718@icloud.com>
Co-authored-by: Bennet <bennetbo@gmx.de>
This commit is contained in:
Thorsten Ball 2024-01-25 16:58:47 +01:00
parent f7a2118b15
commit c4cf5f2b2c
5 changed files with 128 additions and 205 deletions

View file

@ -11,12 +11,11 @@ use itertools::Itertools;
use language::CursorShape;
use settings::Settings;
use terminal::{
alacritty_terminal::ansi::NamedColor,
alacritty_terminal::{
ansi::{Color as AnsiColor, Color::Named, CursorShape as AlacCursorShape},
grid::Dimensions,
index::Point as AlacPoint,
term::{cell::Flags, TermMode},
vte::ansi::{Color as AnsiColor, Color::Named, CursorShape as AlacCursorShape, NamedColor},
},
terminal_settings::TerminalSettings,
IndexedCell, Terminal, TerminalContent, TerminalSize,
@ -308,7 +307,7 @@ impl TerminalElement {
/// Converts the Alacritty cell styles to GPUI text styles and background color.
fn cell_style(
indexed: &IndexedCell,
fg: terminal::alacritty_terminal::ansi::Color,
fg: terminal::alacritty_terminal::vte::ansi::Color,
// bg: terminal::alacritty_terminal::ansi::Color,
colors: &Theme,
text_style: &TextStyle,
@ -998,11 +997,11 @@ fn to_highlighted_range_lines(
}
/// Converts a 2, 8, or 24 bit color ANSI color to the GPUI equivalent.
fn convert_color(fg: &terminal::alacritty_terminal::ansi::Color, theme: &Theme) -> Hsla {
fn convert_color(fg: &terminal::alacritty_terminal::vte::ansi::Color, theme: &Theme) -> Hsla {
let colors = theme.colors();
match fg {
// Named and theme defined colors
terminal::alacritty_terminal::ansi::Color::Named(n) => match n {
terminal::alacritty_terminal::vte::ansi::Color::Named(n) => match n {
NamedColor::Black => colors.terminal_ansi_black,
NamedColor::Red => colors.terminal_ansi_red,
NamedColor::Green => colors.terminal_ansi_green,
@ -1034,11 +1033,11 @@ fn convert_color(fg: &terminal::alacritty_terminal::ansi::Color, theme: &Theme)
NamedColor::DimForeground => colors.terminal_dim_foreground,
},
// 'True' colors
terminal::alacritty_terminal::ansi::Color::Spec(rgb) => {
terminal::alacritty_terminal::vte::ansi::Color::Spec(rgb) => {
terminal::rgba_color(rgb.r, rgb.g, rgb.b)
}
// 8 bit, indexed colors
terminal::alacritty_terminal::ansi::Color::Indexed(i) => {
terminal::alacritty_terminal::vte::ansi::Color::Indexed(i) => {
terminal::get_color_at_index(*i as usize, theme)
}
}