summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-07-22 22:29:14 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-07-22 22:32:14 -0400
commit97ca1fb6d44de66d872422783c38ae198b0edfb9 (patch)
tree695eacc8aaeda28f32fd839169fb8862caf09571 /src/util
parent4385f6eb523ece963b154f2525f82e8e9f3882f1 (diff)
add automatically_count_files option
- for now, this disables counting number of files in a directory - future plans is to change this to opportunistic file counting - i.e. if we already have the directory loaded, then finding the file count is pretty trivial - it just requires a bit of refactoring
Diffstat (limited to 'src/util')
-rw-r--r--src/util/display.rs6
-rw-r--r--src/util/input.rs4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/util/display.rs b/src/util/display.rs
index e271843..913f063 100644
--- a/src/util/display.rs
+++ b/src/util/display.rs
@@ -10,6 +10,7 @@ pub const fn default_column_ratio() -> (usize, usize, usize) {
#[derive(Clone, Debug)]
pub struct DisplayOption {
+ pub _automatically_count_files: bool,
pub _collapse_preview: bool,
pub column_ratio: (usize, usize, usize),
pub _show_borders: bool,
@@ -23,6 +24,10 @@ pub struct DisplayOption {
}
impl DisplayOption {
+ pub fn automatically_count_files(&self) -> bool {
+ self._automatically_count_files
+ }
+
pub fn collapse_preview(&self) -> bool {
self._collapse_preview
}
@@ -86,6 +91,7 @@ impl std::default::Default for DisplayOption {
];
Self {
+ _automatically_count_files: false,
_collapse_preview: true,
column_ratio,
_show_borders: true,
diff --git a/src/util/input.rs b/src/util/input.rs
index 7726bc8..2aa1c76 100644
--- a/src/util/input.rs
+++ b/src/util/input.rs
@@ -66,7 +66,9 @@ pub fn process_finished_worker(context: &mut AppContext, res: std::io::Result<Io
pub fn process_dir_preview(context: &mut AppContext, dirlist: JoshutoDirList) {
let history = context.tab_context_mut().curr_tab_mut().history_mut();
- match history.entry(dirlist.file_path().to_path_buf()) {
+
+ let dir_path = dirlist.file_path().to_path_buf();
+ match history.entry(dir_path) {
Entry::Occupied(mut entry) => {
let old_dirlist = entry.get();
if old_dirlist.need_update() {