summaryrefslogtreecommitdiffstats
path: root/src/commands/sort.rs
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-06-21 19:44:17 -0400
committerGitHub <noreply@github.com>2021-06-21 19:44:17 -0400
commit34538845ba899a6892c6bbc10d294f209b78fdd7 (patch)
tree167474092e146951da856a995088aaf730a85c7d /src/commands/sort.rs
parentcf660136ea43e0a463fd270bfdaf8bb3ee606d9d (diff)
fix file sizes not appearing when filename too long (#78)
* fix file sizes not appearing when filename too long * refactor previewing code - event.rs is moved out of utils as its an integral part of the codebase - load_child.rs has been replaced with preview module - moved previewing logic inside run.rs instead of spreading it across multiple commands * revert tui_dirlist_detailed to use MIN_LEFT_LABEL_WIDTH - add previewing loading trigger to mouse input as well * fix: right label disappears (#79) Co-authored-by: DLFW <daniel@llin.info>
Diffstat (limited to 'src/commands/sort.rs')
-rw-r--r--src/commands/sort.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/commands/sort.rs b/src/commands/sort.rs
index 58ffd2e..dfc86a2 100644
--- a/src/commands/sort.rs
+++ b/src/commands/sort.rs
@@ -1,8 +1,6 @@
use crate::context::AppContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
-
-use crate::util::load_child::LoadChild;
use crate::util::sort::SortType;
use super::reload;
@@ -15,10 +13,7 @@ pub fn set_sort(context: &mut AppContext, method: SortType) -> JoshutoResult<()>
for tab in context.tab_context_mut().iter_mut() {
tab.history_mut().depreciate_all_entries();
}
-
- reload::soft_reload(context.tab_context_ref().index, context)?;
- LoadChild::load_child(context)?;
- Ok(())
+ refresh(context)
}
pub fn toggle_reverse(context: &mut AppContext) -> JoshutoResult<()> {
@@ -28,7 +23,10 @@ pub fn toggle_reverse(context: &mut AppContext) -> JoshutoResult<()> {
for tab in context.tab_context_mut().iter_mut() {
tab.history_mut().depreciate_all_entries();
}
+ refresh(context)
+}
+
+fn refresh(context: &mut AppContext) -> JoshutoResult<()> {
reload::soft_reload(context.tab_context_ref().index, context)?;
- LoadChild::load_child(context)?;
Ok(())
}