mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
Pass the Busybox's Unicode test for fold
This commit is contained in:
parent
573ca2931b
commit
8ede3fa0dc
1 changed files with 5 additions and 13 deletions
|
@ -140,19 +140,11 @@ fn fold_file<T: io::Reader>(file: BufferedReader<T>, bytes: bool, spaces: bool,
|
|||
}
|
||||
} else {
|
||||
let mut len = line.char_len();
|
||||
let newline =
|
||||
if len == 0 {
|
||||
continue;
|
||||
} else if len == 1 && line.char_at(len - 1) == '\n' {
|
||||
println!("");
|
||||
continue;
|
||||
} else if line.char_at(len - 1) == '\n' {
|
||||
line = line.slice_to(line.len() - 1);
|
||||
len -= 1;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let newline = line.ends_with("\n");
|
||||
if newline {
|
||||
line = line.slice_to(line.len() - 1);
|
||||
len -= 1;
|
||||
}
|
||||
let mut output = String::new();
|
||||
let mut count = 0;
|
||||
for (i, ch) in line.chars().enumerate() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue