summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-03-31 20:51:11 +0200
committerCanop <cano.petrole@gmail.com>2022-03-31 20:51:11 +0200
commit51153d26ce0c4ab80c7b0678ddbec03b3b01b34a (patch)
treef9b0468a580d0ae854101eb389953ab6eba8c7f8 /src/app
parent7019073b69a03aeb633ab0fabc84fecbf3482c2b (diff)
Sort by type, with dirs either first or last
3 new internals. With `:st` you can select to sort by type with directories first, sort by type with directories last, or not sorting. Fix #467
Diffstat (limited to 'src/app')
-rw-r--r--src/app/panel_state.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/app/panel_state.rs b/src/app/panel_state.rs
index f1f2375..01b2129 100644
--- a/src/app/panel_state.rs
+++ b/src/app/panel_state.rs
@@ -232,6 +232,40 @@ pub trait PanelState {
bang,
con,
),
+ Internal::sort_by_type => self.with_new_options(
+ screen,
+ &|o| {
+ o.sort = match o.sort {
+ Sort::TypeDirsFirst => Sort::TypeDirsLast,
+ Sort::TypeDirsLast => Sort::None,
+ _ => Sort::TypeDirsFirst,
+ };
+ },
+ bang,
+ con,
+ ),
+ Internal::sort_by_type_dirs_first => self.with_new_options(
+ screen,
+ &|o| {
+ o.sort = match o.sort {
+ Sort::TypeDirsFirst => Sort::None,
+ _ => Sort::TypeDirsFirst,
+ };
+ },
+ bang,
+ con,
+ ),
+ Internal::sort_by_type_dirs_last => self.with_new_options(
+ screen,
+ &|o| {
+ o.sort = match o.sort {
+ Sort::TypeDirsLast => Sort::None,
+ _ => Sort::TypeDirsLast,
+ };
+ },
+ bang,
+ con,
+ ),
Internal::no_sort => self.with_new_options(screen, &|o| o.sort = Sort::None, bang, con),
Internal::toggle_counts => {
self.with_new_options(screen, &|o| o.show_counts ^= true, bang, con)