From fd3eec81b57ada7c3c150eaada0821d2d59fe57b Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Sun, 23 Jan 2022 02:36:40 +0300 Subject: [PATCH] Bump ansi-cut version to 0.2.0 (#822) Signed-off-by: Maxim Zhiburt --- crates/nu-table/Cargo.toml | 2 +- crates/nu-table/src/wrap.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nu-table/Cargo.toml b/crates/nu-table/Cargo.toml index b3a1b4fa3a..12beacb435 100644 --- a/crates/nu-table/Cargo.toml +++ b/crates/nu-table/Cargo.toml @@ -18,5 +18,5 @@ nu-protocol = { path = "../nu-protocol"} regex = "1.4" unicode-width = "0.1.8" strip-ansi-escapes = "0.1.1" -ansi-cut = "0.1.1" +ansi-cut = "0.2.0" atty = "0.2.14" diff --git a/crates/nu-table/src/wrap.rs b/crates/nu-table/src/wrap.rs index 7b1a713db4..bd0e95275a 100644 --- a/crates/nu-table/src/wrap.rs +++ b/crates/nu-table/src/wrap.rs @@ -152,7 +152,7 @@ fn split_word(cell_width: usize, word: &str) -> Vec { let mut end_index; let word_no_ansi = strip_ansi(word); - for c in word_no_ansi.chars().enumerate() { + for c in word_no_ansi.char_indices() { if let Some(width) = c.1.width() { end_index = c.0; if current_width + width > cell_width { @@ -169,7 +169,7 @@ fn split_word(cell_width: usize, word: &str) -> Vec { } } - if start_index != word_no_ansi.chars().count() { + if start_index != word_no_ansi.len() { output.push(Subline { subline: word.cut(start_index..), width: current_width,