Skip to content

Commit

Permalink
Handle OSC133
Browse files Browse the repository at this point in the history
Co-authored-by: Bennet <bennet@zed.dev>
  • Loading branch information
mrnugget and bennetbo committed Sep 13, 2024
1 parent 8dfd2e5 commit c9c7176
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
17 changes: 10 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion alacritty/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,10 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
TerminalEvent::PtyWrite(text) => self.ctx.write_to_pty(text.into_bytes()),
TerminalEvent::MouseCursorDirty => self.reset_mouse_cursor(),
TerminalEvent::CursorBlinkingChange => self.ctx.update_cursor_blinking(),
TerminalEvent::Exit | TerminalEvent::ChildExit(_) | TerminalEvent::Wakeup => (),
TerminalEvent::Exit
| TerminalEvent::ChildExit(_)
| TerminalEvent::Wakeup
| TerminalEvent::Osc133(_) => {},
},
#[cfg(unix)]
EventType::IpcConfig(_) => (),
Expand Down
12 changes: 9 additions & 3 deletions alacritty_terminal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "alacritty_terminal"
version = "0.24.1-dev"
authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"]
authors = [
"Christian Duerr <contact@christianduerr.com>",
"Joe Wilm <joe@jwilm.com>",
]
license = "Apache-2.0"
description = "Library for writing terminal emulators"
readme = "../README.md"
Expand All @@ -24,7 +27,10 @@ parking_lot = "0.12.0"
polling = "3.0.0"
regex-automata = "0.4.3"
unicode-width = "0.1"
vte = { version = "0.13.0", default-features = false, features = ["ansi", "serde"] }
vte = { version = "0.13.0", default-features = false, features = [
"ansi",
"serde",
], git = "https://github.com/zed-industries/vte", branch = "osc-133-2" }
serde = { version = "1", features = ["derive", "rc"], optional = true }

[target.'cfg(unix)'.dependencies]
Expand All @@ -41,7 +47,7 @@ windows-sys = { version = "0.52.0", features = [
"Win32_System_LibraryLoader",
"Win32_System_Threading",
"Win32_System_WindowsProgramming",
]}
] }

[dev-dependencies]
serde_json = "1.0.0"
3 changes: 3 additions & 0 deletions alacritty_terminal/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub enum Event {

/// Child process exited with an error code.
ChildExit(i32),

Osc133(vte::ansi::Osc133Command),
}

impl Debug for Event {
Expand All @@ -73,6 +75,7 @@ impl Debug for Event {
Event::Bell => write!(f, "Bell"),
Event::Exit => write!(f, "Exit"),
Event::ChildExit(code) => write!(f, "ChildExit({code})"),
Event::Osc133(command) => write!(f, "Osc133({command:?})")
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions alacritty_terminal/src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,12 @@ impl<T: EventListener> Handler for Term<T> {
let text = format!("\x1b[8;{};{}t", self.screen_lines(), self.columns());
self.event_proxy.send_event(Event::PtyWrite(text));
}

#[inline]
fn handle_osc133(&mut self, command: vte::ansi::Osc133Command) {
println!("OSC 133 command: {:?}", command);
self.event_proxy.send_event(Event::Osc133(command));
}
}

/// The state of the [`Mode`] and [`PrivateMode`].
Expand Down

0 comments on commit c9c7176

Please sign in to comment.