diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-08-07 05:23:17 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-07 05:23:17 +0400 |
commit | 8cf8505956aaab7565902c900b514a018a579d35 (patch) | |
tree | 0223571cc31eee24486cf205588164dc775331e8 | |
parent | 94e74f3a64f42d5dad4e3d42dbe8c23291038214 (diff) | |
download | r-alacritty-vte-8cf8505956aaab7565902c900b514a018a579d35.tar.gz r-alacritty-vte-8cf8505956aaab7565902c900b514a018a579d35.tar.bz2 r-alacritty-vte-8cf8505956aaab7565902c900b514a018a579d35.zip |
Add support for OSC 22
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/ansi.rs | 13 |
3 files changed, 19 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fd44f7..7abdcae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ CHANGELOG ========= +## Unreleased + +- Add support for OSC 22 + ## 0.11.1 - Minimum rust version has been bumped to 1.62.1 @@ -14,6 +14,7 @@ edition = "2021" rust-version = "1.62.1" [dependencies] +cursor-icon = { version = "1.0.0", default-features = false, optional = true } vte_generate_state_changes = { version = "0.1.0", path = "vte_generate_state_changes" } arrayvec = { version = "0.7.2", default-features = false, optional = true } log = { version = "0.4.17", optional = true } @@ -21,7 +22,7 @@ utf8parse = { version = "0.2.0", path = "utf8parse" } serde = { version = "1.0.160", features = ["derive"], optional = true } [features] -ansi = ["log"] +ansi = ["log", "cursor-icon"] serde = ["dep:serde"] default = ["no_std"] no_std = ["arrayvec"] diff --git a/src/ansi.rs b/src/ansi.rs index 1385802..cd9499d 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -25,6 +25,7 @@ use core::ops::Mul; #[cfg(not(feature = "no_std"))] use std::time::Instant; +use cursor_icon::CursorIcon; use log::{debug, trace}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; @@ -668,6 +669,9 @@ pub trait Handler { /// Set hyperlink. fn set_hyperlink(&mut self, _: Option<Hyperlink>) {} + + /// Set mouse cursor icon. + fn set_mouse_cursor_icon(&mut self, _: CursorIcon) {} } /// Terminal cursor configuration. @@ -1267,6 +1271,15 @@ where unhandled(params); }, + // Set mouse cursor shape. + b"22" if params.len() == 2 => { + let shape = String::from_utf8_lossy(params[1]); + match CursorIcon::from_str(&shape) { + Ok(cursor_icon) => self.handler.set_mouse_cursor_icon(cursor_icon), + Err(_) => debug!("[osc 22] unrecognized cursor icon shape: {shape:?}"), + } + }, + // Set cursor style. b"50" => { if params.len() >= 2 |