See this code:
|
/// Create a cell from an `OsString` |
|
fn from_os_string(os: &OsString) -> Self { |
|
Self { |
|
bytes: uucore::os_str_as_bytes(os).unwrap().to_vec(), |
|
width: UnicodeWidthStr::width(os.to_string_lossy().as_ref()), |
|
} |
|
} |
It gets the width of the lossy string but stores the raw bytes. I think this at least deserves a comment explaining this is intentional. Because it's not entirely clear to me if doing a lossy conversion may use more or less cells.
See this code:
coreutils/src/uu/df/src/table.rs
Lines 265 to 271 in 30fd234
It gets the width of the lossy string but stores the raw bytes. I think this at least deserves a comment explaining this is intentional. Because it's not entirely clear to me if doing a lossy conversion may use more or less cells.