diff options
Diffstat (limited to 'alacritty_terminal/src')
-rw-r--r-- | alacritty_terminal/src/ansi.rs | 10 | ||||
-rw-r--r-- | alacritty_terminal/src/term/cell.rs | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs index 53495995..c47007d8 100644 --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1014,7 +1014,15 @@ where // Hyperlink. b"8" if params.len() > 2 => { let link_params = params[1]; - let uri = str::from_utf8(params[2]).unwrap_or_default(); + + // NOTE: The escape sequence is of form 'OSC 8 ; params ; URI ST', where + // URI is URL-encoded. However `;` is a special character and might be + // passed as is, thus we need to rebuild the URI. + let mut uri = str::from_utf8(params[2]).unwrap_or_default().to_string(); + for param in params[3..].iter() { + uri.push(';'); + uri.push_str(str::from_utf8(param).unwrap_or_default()); + } // The OSC 8 escape sequence must be stopped when getting an empty `uri`. if uri.is_empty() { diff --git a/alacritty_terminal/src/term/cell.rs b/alacritty_terminal/src/term/cell.rs index bd331c68..3e7d09e5 100644 --- a/alacritty_terminal/src/term/cell.rs +++ b/alacritty_terminal/src/term/cell.rs @@ -43,7 +43,7 @@ pub struct Hyperlink { } impl Hyperlink { - pub fn new<T: ToString>(id: Option<T>, uri: T) -> Self { + pub fn new<T: ToString>(id: Option<T>, uri: String) -> Self { let inner = Arc::new(HyperlinkInner::new(id, uri)); Self { inner } } @@ -67,7 +67,7 @@ struct HyperlinkInner { } impl HyperlinkInner { - pub fn new<T: ToString>(id: Option<T>, uri: T) -> Self { + pub fn new<T: ToString>(id: Option<T>, uri: String) -> Self { let id = match id { Some(id) => id.to_string(), None => { @@ -77,7 +77,7 @@ impl HyperlinkInner { }, }; - Self { id, uri: uri.to_string() } + Self { id, uri } } } |