Skip to content

Commit

Permalink
Hide mtime column by default, unless enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrwach committed Nov 24, 2023
1 parent 2bd06be commit 0f8377a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ impl Entries {
Style { fg, ..style }
},
);
vec![mtime, bar, bytes, left_bar, percentage, right_bar, name]

if should_show_mtime_column(sort_mode) {
vec![mtime, bar, bytes, left_bar, percentage, right_bar, name]
} else {
vec![bytes, left_bar, percentage, right_bar, name]
}
},
);

Expand Down Expand Up @@ -221,3 +226,10 @@ impl Entries {
}
}
}

fn should_show_mtime_column(sort_mode: &SortMode) -> bool {
match sort_mode {
SortMode::MTimeAscending | SortMode::MTimeDescending => true,
_ => false,
}
}
2 changes: 1 addition & 1 deletion src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ mod tests {
fn size_of_entry_data() {
assert_eq!(
std::mem::size_of::<EntryData>(),
if cfg!(windows) { 56 } else { 48 },
if cfg!(windows) { 72 } else { 64 },
"the size of this should not change unexpectedly as it affects overall memory consumption"
);
}
Expand Down

0 comments on commit 0f8377a

Please sign in to comment.