Skip to content

Commit

Permalink
Try to fix tabled panic
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiburt committed Dec 31, 2024
1 parent 378395c commit 00c819f
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions crates/nu-table/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,25 @@ pub fn clean_charset(text: &str) -> String {
// We could shrink it but...it will be another realloc which make no scense.
let mut buf = String::with_capacity(text.len());

for c in text.chars() {
if c == '\n' {
buf.push(c);
continue;
}
// note: (Left just in case)
// note: This check could be added in order to cope with emojie issue.
// if c < ' ' && c != '\u{1b}' {
// continue;
// }

if c == '\t' {
buf.push(' ');
buf.push(' ');
buf.push(' ');
buf.push(' ');
continue;
for c in text.chars() {
match c {
'\r' => continue,
'\t' => {
buf.push(' ');
buf.push(' ');
buf.push(' ');
buf.push(' ');
}
c => {
buf.push(c);
}
}

// note: Overall maybe we shall delete this check?
// it was made in order to cope with emojie issue.
// if c < ' ' && c != '\u{1b}' {
// continue;
// }

buf.push(c);
}

buf
Expand Down

0 comments on commit 00c819f

Please sign in to comment.