From b0d55bb846846af9384ca17cfe62f998f7a9cce9 Mon Sep 17 00:00:00 2001 From: ehwan Date: Wed, 19 Jun 2024 14:06:15 +0900 Subject: [PATCH] fix unicode-width version to 0.1.13 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/display.rs | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbfaebb75..7c4a86d74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unsafe-libyaml" diff --git a/Cargo.toml b/Cargo.toml index 6a5a0d981..b2c1552b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ once_cell = "1.17.1" chrono = { version = "0.4.19", features = ["unstable-locales"] } chrono-humanize = "0.2" # unicode-width 0.1.13 has a breaking change so stick to 0.1.11 -unicode-width = "=0.1.11" +unicode-width = "0.1.13" lscolors = "0.16.0" wild = "2.0" globset = "0.4.*" diff --git a/src/display.rs b/src/display.rs index 6729529dd..adb55db94 100644 --- a/src/display.rs +++ b/src/display.rs @@ -439,7 +439,8 @@ fn get_visible_width(input: &str, hyperlink: bool) -> usize { let m_pos = s.find('m'); if let Some(len) = m_pos { - nb_invisible_char += len + // len points to the 'm' character, we must include 'm' to invisible characters + nb_invisible_char += len + 1; } } @@ -449,7 +450,8 @@ fn get_visible_width(input: &str, hyperlink: bool) -> usize { let m_pos = s.find("\x1B\x5C"); if let Some(len) = m_pos { - nb_invisible_char += len + // len points to the '\x1B' character, we must include both '\x1B' and '\x5C' to invisible characters + nb_invisible_char += len + 2 } } }