mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 06:02:36 +00:00
fix name padding to include indicator's length
This commit is contained in:
parent
433ead289e
commit
c3a9f9c62e
2 changed files with 8 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::color::Colors;
|
||||
use crate::flags::{Display, Flags, Layout, Block};
|
||||
use crate::flags::{Block, Display, Flags, Layout};
|
||||
use crate::icon::Icons;
|
||||
use crate::meta::{FileType, Meta};
|
||||
use ansi_term::{ANSIString, ANSIStrings};
|
||||
|
@ -314,6 +314,7 @@ fn get_long_output(
|
|||
strings.push(ANSIString::from(" ".to_string().repeat(
|
||||
padding_rules.name_with_symlink
|
||||
- meta.name.name_string(icons).len()
|
||||
- meta.indicator.len()
|
||||
- s.len(),
|
||||
)))
|
||||
}
|
||||
|
@ -323,7 +324,8 @@ fn get_long_output(
|
|||
strings.push(meta.symlink.render(colors));
|
||||
strings.push(ANSIString::from(" ".to_string().repeat(
|
||||
padding_rules.name_with_symlink + 3
|
||||
- meta.name.name_string(icons).len(),
|
||||
- meta.name.name_string(icons).len()
|
||||
- meta.indicator.len(),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ impl Indicator {
|
|||
ANSIString::from("")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue