changed a character

This commit is contained in:
Guilleag01
2023-11-26 10:06:58 +01:00
parent e99d64326b
commit eb00f02843
2 changed files with 3 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ fn print_elements(
&new_is_last_element, &new_is_last_element,
i == elements.len() - 1, i == elements.len() - 1,
" ", " ",
"| ", " ",
) )
} }
e_name.push_str(" "); e_name.push_str(" ");
@@ -184,7 +184,7 @@ fn print_footer(num_elements: usize, name_length: usize) {
fn get_max_width(elements: &Vec<Element>, recursive_limit: usize, current_depth: usize) -> usize { fn get_max_width(elements: &Vec<Element>, recursive_limit: usize, current_depth: usize) -> usize {
let mut name_max_len = 0; let mut name_max_len = 0;
for e in elements { for e in elements {
let mut length = get_string_length(e.to_string().as_str()) + current_depth * 2; let mut length = e.to_string().chars().count() + current_depth * 2;
if e.get_file_type() == TypeOfFile::Dir && current_depth < recursive_limit { if e.get_file_type() == TypeOfFile::Dir && current_depth < recursive_limit {
let recursive_width = get_max_width( let recursive_width = get_max_width(
&get_elements_from_path(e.get_path_string(), true), &get_elements_from_path(e.get_path_string(), true),

View File

@@ -77,7 +77,7 @@ pub fn system_time_to_string(system_time: SystemTime) -> String {
datetime.format("%d-%m-%y %H:%M").to_string() datetime.format("%d-%m-%y %H:%M").to_string()
} }
pub fn sort_elements(elements: &mut Vec<Element>, sort_by: &SortBy) { pub fn sort_elements(elements: &mut [Element], sort_by: &SortBy) {
match sort_by { match sort_by {
SortBy::NONE => (), SortBy::NONE => (),
SortBy::NAME => elements.sort_unstable_by_key(|a| a.get_name().to_lowercase()), SortBy::NAME => elements.sort_unstable_by_key(|a| a.get_name().to_lowercase()),