From 2bf201e3fda7410f014743b2c04431ec370597ff Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Thu, 30 Nov 2017 13:24:13 +0100 Subject: [PATCH] Inject soft hyphen into commit hash so it works better on more screens --- src/build_config.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/build_config.rs b/src/build_config.rs index 0733014..9c16d76 100644 --- a/src/build_config.rs +++ b/src/build_config.rs @@ -5,6 +5,8 @@ pub const PROJECT_NAME: &str = env!("CARGO_PKG_NAME"); +const SOFT_HYPHEN: &str = "\u{00AD}"; + lazy_static! { pub static ref VERSION: String = || -> String { let mut components = Vec::::new(); @@ -24,7 +26,17 @@ lazy_static! { } if let Some(commit) = option_env!("TRAVIS_COMMIT") { - components.push(format!("commit:{}", commit)); + components.push(format!("commit:{}", + commit + .as_bytes() + .chunks(4) + .map(|x| + String::from_utf8(x.to_owned()) + .unwrap_or_else(|_| String::new()) + ) + .collect::>() + .join(SOFT_HYPHEN) + )); } if components.len() > 0 {