From a2a0299ea54e0b5b81a8770926e53d75f373abed Mon Sep 17 00:00:00 2001 From: a-kenji Date: Mon, 25 Oct 2021 20:08:30 +0200 Subject: [PATCH] add(setup): change the links to be hyperlinks (#768) - change the links in the setup command to be viable hyperlinks according to: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda --- zellij-utils/src/setup.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index 975ff333cf..1ca596ffc5 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -266,6 +266,12 @@ impl Setup { .clone() .or_else(|| config_dir.clone().map(|p| p.join(CONFIG_NAME))); + // according to + // https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda + let hyperlink_start = "\u{1b}]8;;"; + let hyperlink_mid = "\u{1b}\\"; + let hyperlink_end = "\u{1b}]8;;\u{1b}\\\n'"; + let mut message = String::new(); message.push_str(&format!("[Version]: {:?}\n", VERSION)); @@ -310,10 +316,26 @@ impl Setup { message.push_str(&format!("[ARROW SEPARATOR]: {}\n", ARROW_SEPARATOR)); message.push_str(" Is the [ARROW_SEPARATOR] displayed correctly?\n"); message.push_str(" If not you may want to either start zellij with a compatible mode 'zellij options --simplified-ui'\n"); - message.push_str(" Or check the font that is in use:\n https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly\n"); + let mut hyperlink_compat = String::new(); + hyperlink_compat.push_str(hyperlink_start); + hyperlink_compat.push_str("https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly"); + hyperlink_compat.push_str(hyperlink_mid); + hyperlink_compat.push_str("https://zellij.dev/documentation/compatibility.html#the-status-bar-fonts-dont-render-correctly"); + hyperlink_compat.push_str(hyperlink_end); + message.push_str(&format!( + " Or check the font that is in use:\n {}\n", + hyperlink_compat + )); message.push_str(&format!("[FEATURES]: {:?}\n", FEATURES)); - message.push_str("[DOCUMENTATION]: zellij.dev/documentation/\n"); + let mut hyperlink = String::new(); + hyperlink.push_str(hyperlink_start); + hyperlink.push_str("https://www.zellij.dev/documentation/"); + hyperlink.push_str(hyperlink_mid); + hyperlink.push_str("zellij.dev/documentation"); + hyperlink.push_str(hyperlink_end); + message.push_str(&format!("[DOCUMENTATION]: {}", hyperlink)); + //printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n' std::io::stdout().write_all(message.as_bytes())?;