Skip to content

Commit b0d55bb

Browse files
ehwanzwpaper
authored andcommitted
fix unicode-width version to 0.1.13
1 parent 5918660 commit b0d55bb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ once_cell = "1.17.1"
3636
chrono = { version = "0.4.19", features = ["unstable-locales"] }
3737
chrono-humanize = "0.2"
3838
# unicode-width 0.1.13 has a breaking change so stick to 0.1.11
39-
unicode-width = "=0.1.11"
39+
unicode-width = "0.1.13"
4040
lscolors = "0.16.0"
4141
wild = "2.0"
4242
globset = "0.4.*"

src/display.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ fn get_visible_width(input: &str, hyperlink: bool) -> usize {
439439

440440
let m_pos = s.find('m');
441441
if let Some(len) = m_pos {
442-
nb_invisible_char += len
442+
// len points to the 'm' character, we must include 'm' to invisible characters
443+
nb_invisible_char += len + 1;
443444
}
444445
}
445446

@@ -449,7 +450,8 @@ fn get_visible_width(input: &str, hyperlink: bool) -> usize {
449450

450451
let m_pos = s.find("\x1B\x5C");
451452
if let Some(len) = m_pos {
452-
nb_invisible_char += len
453+
// len points to the '\x1B' character, we must include both '\x1B' and '\x5C' to invisible characters
454+
nb_invisible_char += len + 2
453455
}
454456
}
455457
}

0 commit comments

Comments
 (0)