Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/egui-term/src/alacritty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ impl Terminal {
let event_proxy = EventProxy(event_sender);
let term = Term::new(config, &term_size, event_proxy.clone());
let term = Arc::new(FairMutex::new(term));

let pty_event_loop = EventLoop::new(term.clone(), event_proxy, pty, false, false)?;
let notifier = Notifier(pty_event_loop.channel());
let pty_notifier = Notifier(pty_event_loop.channel());

let url_regex = r#"(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file://|git://|ssh:|ftp://)[^\u{0000}-\u{001F}\u{007F}-\u{009F}<>"\s{-}\^⟨⟩`]+"#;
let url_regex =
Expand All @@ -246,8 +248,10 @@ impl Terminal {
panic!("pty_event_subscription_{id}: sending PtyEvent is failed, error: {err}")
});
app_context.request_repaint();
if let Event::Exit = event {
break;
match event {
Event::Exit => break,
Event::PtyWrite(s) => pty_notifier.notify(s.into_bytes()),
_ => {}
}
})?;

Expand Down Expand Up @@ -353,6 +357,7 @@ impl<'a> TerminalContext<'a> {
pub fn write_data<I: Into<Cow<'static, [u8]>>>(&mut self, data: I) {
self.write(data);
self.terminal.scroll_display(Scroll::Bottom);
self.terminal.selection = None;
}

fn process_link(&mut self, link_action: LinkAction, point: Point) {
Expand Down
11 changes: 8 additions & 3 deletions crates/egui-term/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,15 @@ impl<'a> TerminalView<'a> {
modifiers,
pos,
} => {
let new_pos = if is_in_terminal(pos, layout.rect) {
pos
} else {
let out_of = !is_in_terminal(pos, layout.rect);
if out_of && pressed {
continue;
}

let new_pos = if out_of {
pos.clamp(layout.rect.min, layout.rect.max)
} else {
pos
};

if let Some(action) =
Expand Down
Loading