Update to alacritty_terminal v0.20

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
Mohammad AlSaleh 2023-12-31 12:50:54 +03:00 committed by Jeremy Soller
parent 0866a6897d
commit fb2b251a33
5 changed files with 142 additions and 433 deletions

538
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
alacritty_terminal = "0.19"
alacritty_terminal = "0.20"
env_logger = "0.10"
lazy_static = "1"
log = "0.4"

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use alacritty_terminal::{
config::Config as TermConfig, event::Event as TermEvent, term::color::Colors as TermColors, tty,
event::Event as TermEvent, term::color::Colors as TermColors, term::Config as TermConfig, tty,
};
use cosmic::{
app::{message, Command, Core, Settings},
@ -22,7 +22,7 @@ use cosmic::{
Application, ApplicationExt, Element,
};
use cosmic_text::Family;
use std::{any::TypeId, collections::HashMap, process, sync::Mutex};
use std::{any::TypeId, collections::HashMap, env, process, sync::Mutex};
use tokio::sync::mpsc;
use config::{AppTheme, Config, CONFIG_VERSION};
@ -74,11 +74,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
};
let term_config = TermConfig::default();
// Set up environmental variables for terminal
let mut term_config = TermConfig::default();
tty::setup_env();
// Override TERM for better compatibility
term_config.env.insert("TERM".to_string(), "xterm-256color".to_string());
tty::setup_env(&term_config);
env::set_var("TERM", "xterm-256color");
let mut settings = Settings::default();
settings = settings.theme(config.app_theme.theme());
@ -557,7 +557,7 @@ impl Application for App {
let terminal = Terminal::new(
entity,
term_event_tx.clone(),
&self.term_config,
self.term_config.clone(),
colors.clone(),
);
self.tab_model

View file

@ -1,6 +1,4 @@
use alacritty_terminal::{
ansi::{Color, NamedColor},
config::Config,
event::{Event, EventListener, Notify, OnResize, WindowSize},
event_loop::{EventLoop, Msg, Notifier},
grid::Dimensions,
@ -9,10 +7,13 @@ use alacritty_terminal::{
sync::FairMutex,
term::{
cell::Flags,
color::{self, Colors, Rgb},
color::{self, Colors},
Config,
viewport_to_point, TermMode,
},
tty, Term,
tty::{self, Options},
Term,
vte::ansi::{Color, NamedColor, Rgb},
};
use cosmic::{iced::advanced::graphics::text::font_system, widget::segmented_button};
use cosmic_text::{
@ -111,7 +112,7 @@ impl Terminal {
pub fn new(
entity: segmented_button::Entity,
event_tx: mpsc::Sender<(segmented_button::Entity, Event)>,
config: &Config,
config: Config,
colors: Colors,
) -> Self {
let metrics = Metrics::new(14.0, 20.0);
@ -141,19 +142,21 @@ impl Terminal {
};
let event_proxy = EventProxy(entity, event_tx);
let term = Arc::new(FairMutex::new(Term::new(
&config,
config,
&size,
event_proxy.clone(),
)));
let window_id = 0;
let pty = tty::new(&config.pty_config, size.into(), window_id).unwrap();
let options = Options::default();
let pty = tty::new(&options, size.into(), window_id).unwrap();
let pty_event_loop = EventLoop::new(
term.clone(),
event_proxy,
pty,
config.pty_config.hold,
options.hold,
false,
);
let notifier = Notifier(pty_event_loop.channel());

View file

@ -1,6 +1,6 @@
use alacritty_terminal::{
ansi::NamedColor,
term::color::{Colors, Rgb},
term::color::Colors,
vte::ansi::{NamedColor, Rgb},
};
use std::collections::HashMap;