diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-12-18 22:18:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 01:18:42 +0300 |
commit | 6d1a63ef28d18168ed4ca0d6a8c3413cb4621ca5 (patch) | |
tree | 8fa922ffd541f6d4da24f677f2eab4934692f511 /alacritty/src/input.rs | |
parent | f1802c1cda7b9922f23d872705653beb6b053f2e (diff) | |
download | r-alacritty-6d1a63ef28d18168ed4ca0d6a8c3413cb4621ca5.tar.gz r-alacritty-6d1a63ef28d18168ed4ca0d6a8c3413cb4621ca5.tar.bz2 r-alacritty-6d1a63ef28d18168ed4ca0d6a8c3413cb4621ca5.zip |
Remove shared PID/FD variables
The existing PID/FD atomics in alacritty_terminal/src/tty/unix.rs were
shared across all Alacritty windows, causing problem with the new
multiwindow feature.
Instead of sharing these between the different windows, the master FD
and shell PID are now stored on the `window_context`.
Unfortunately this makes spawning new daemons a little more complicated,
having to pass through additional parameters. To ease this a little bit
the helper method `spawn_daemon` has been defined on the
`ActionContext`, making it accessible from most parts of Alacritty's
event loop.
Fixes #5700.
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r-- | alacritty/src/input.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 07b3154c..40b18ca2 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -7,6 +7,8 @@ use std::borrow::Cow; use std::cmp::{max, min, Ordering}; +use std::ffi::OsStr; +use std::fmt::Debug; use std::marker::PhantomData; use std::time::{Duration, Instant}; @@ -30,7 +32,6 @@ use alacritty_terminal::vi_mode::ViMotion; use crate::clipboard::Clipboard; use crate::config::{Action, BindingMode, Key, MouseAction, SearchAction, UiConfig, ViAction}; -use crate::daemon::start_daemon; use crate::display::hint::HintMatch; use crate::display::window::Window; use crate::display::Display; @@ -107,6 +108,12 @@ pub trait ActionContext<T: EventListener> { fn trigger_hint(&mut self, _hint: &HintMatch) {} fn expand_selection(&mut self) {} fn paste(&mut self, _text: &str) {} + fn spawn_daemon<I, S>(&self, _program: &str, _args: I) + where + I: IntoIterator<Item = S> + Debug + Copy, + S: AsRef<OsStr>, + { + } } impl Action { @@ -139,7 +146,7 @@ impl<T: EventListener> Execute<T> for Action { ctx.scroll(Scroll::Bottom); ctx.write_to_pty(s.clone().into_bytes()) }, - Action::Command(program) => start_daemon(program.program(), program.args()), + Action::Command(program) => ctx.spawn_daemon(program.program(), program.args()), Action::Hint(hint) => { ctx.display().hint_state.start(hint.clone()); ctx.mark_dirty(); |