mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 13:37:48 +00:00
ls: fix grid alignment for unicode
This commit is contained in:
parent
a0eb4a0283
commit
58fd61b3e8
1 changed files with 2 additions and 1 deletions
|
@ -40,6 +40,7 @@ use std::{
|
||||||
};
|
};
|
||||||
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
||||||
use time::{strftime, Timespec};
|
use time::{strftime, Timespec};
|
||||||
|
use unicode_width::UnicodeWidthStr;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
|
use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
|
||||||
|
|
||||||
|
@ -1617,7 +1618,7 @@ fn display_file_name(path: &PathData, strip: Option<&Path>, config: &Config) ->
|
||||||
|
|
||||||
// We need to keep track of the width ourselfs instead of letting term_grid
|
// We need to keep track of the width ourselfs instead of letting term_grid
|
||||||
// infer it because the color codes mess up term_grid's width calculation.
|
// infer it because the color codes mess up term_grid's width calculation.
|
||||||
let mut width = name.len();
|
let mut width = name.width();
|
||||||
|
|
||||||
if let Some(ls_colors) = &config.color {
|
if let Some(ls_colors) = &config.color {
|
||||||
name = color_name(&ls_colors, &path.p_buf, name, path.md()?);
|
name = color_name(&ls_colors, &path.p_buf, name, path.md()?);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue