Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use instant rather than process ids for terminal ids
Browse files Browse the repository at this point in the history
melody-rs committed Mar 21, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 861006e commit a84f529
Showing 2 changed files with 1 addition and 9 deletions.
7 changes: 0 additions & 7 deletions crates/term/src/backends/process.rs
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ pub struct Process {
term: Arc<FairMutex<Term<ForwardEventListener>>>,
notifier: Notifier,
event_reciever: Receiver<Event>,
process_id: u32,
}

#[derive(Clone)]
@@ -68,7 +67,6 @@ impl Process {
},
0,
)?;
let process_id = pty.child().id();

let (sender, event_reciever) = std::sync::mpsc::channel();
let event_proxy = ForwardEventListener(sender);
@@ -97,15 +95,10 @@ impl Process {

Ok(Self {
term,
process_id,
notifier,
event_reciever,
})
}

pub fn process_id(&self) -> u32 {
self.process_id
}
}

impl Backend for Process {
3 changes: 1 addition & 2 deletions crates/term/src/widget/mod.rs
Original file line number Diff line number Diff line change
@@ -77,10 +77,9 @@ impl ProcessTerminal {
hold: false,
};
let backend = crate::backends::Process::new(&options, config)?;
let process_id = backend.process_id();
Ok(Self::new(
backend,
egui::Id::new("luminol_term_process").with(process_id),
egui::Id::new("luminol_term_process").with(std::time::Instant::now()),
))
}
}

0 comments on commit a84f529

Please sign in to comment.