fix name padding to include indicator's length

This commit is contained in:
thammin 2019-06-17 12:10:41 +09:00 committed by Abin Simon
parent 433ead289e
commit c3a9f9c62e
2 changed files with 8 additions and 2 deletions

View file

@ -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(),
)))
}
}

View file

@ -29,6 +29,10 @@ impl Indicator {
ANSIString::from("")
}
}
pub fn len(&self) -> usize {
self.0.len()
}
}
#[cfg(test)]