summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-12-15 11:48:20 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-12-15 11:48:20 -0500
commit12eb9eed1aeb4f3045b78dd19ae20d07bfea7de9 (patch)
treea2204b1fbef5f1ed93312f94196ded9a5a8c6ec5 /src/util
parentf5902708a6e597064482edfc076248a67882b7c5 (diff)
add option to not collapse preview
- add methods to access config_t - add back home dir path shortening option
Diffstat (limited to 'src/util')
-rw-r--r--src/util/event.rs11
-rw-r--r--src/util/load_child.rs2
-rw-r--r--src/util/worker.rs2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/util/event.rs b/src/util/event.rs
index 3d89503..9e7f120 100644
--- a/src/util/event.rs
+++ b/src/util/event.rs
@@ -12,6 +12,7 @@ pub enum Event {
Input(Key),
IOWorkerProgress(IOWorkerProgress),
IOWorkerResult(io::Result<IOWorkerProgress>),
+ // Filesystem(notify::Result),
}
#[derive(Debug, Clone, Copy)]
@@ -29,7 +30,7 @@ pub struct Events {
pub event_tx: mpsc::Sender<Event>,
event_rx: mpsc::Receiver<Event>,
pub input_tx: mpsc::SyncSender<()>,
- // fileio_handle: thread::JoinHandle<()>,
+ fileio_handle: thread::JoinHandle<()>,
}
impl Events {
@@ -42,7 +43,8 @@ impl Events {
let (event_tx, event_rx) = mpsc::channel();
let event_tx2 = event_tx.clone();
- thread::spawn(move || {
+
+ let fileio_handle = thread::spawn(move || {
let stdin = io::stdin();
let mut keys = stdin.keys();
match keys.next() {
@@ -53,9 +55,9 @@ impl Events {
return;
}
}
- _ => return,
+ Err(_) => return,
},
- _ => return,
+ None => return,
}
while input_rx.recv().is_ok() {
@@ -74,6 +76,7 @@ impl Events {
event_tx,
event_rx,
input_tx,
+ fileio_handle,
}
}
diff --git a/src/util/load_child.rs b/src/util/load_child.rs
index 4d293fc..7d3482c 100644
--- a/src/util/load_child.rs
+++ b/src/util/load_child.rs
@@ -18,7 +18,7 @@ impl LoadChild {
// get preview
if let Some(path) = path {
if path.is_dir() {
- let options = context.config_t.sort_option.clone();
+ let options = context.config_ref().sort_option.clone();
context
.tab_context_mut()
.curr_tab_mut()
diff --git a/src/util/worker.rs b/src/util/worker.rs
index bd062c9..3844a3e 100644
--- a/src/util/worker.rs
+++ b/src/util/worker.rs
@@ -14,7 +14,7 @@ pub fn process_finished_worker(
res: std::io::Result<IOWorkerProgress>,
) {
let observer = context.remove_job().unwrap();
- let options = context.config_t.sort_option.clone();
+ let options = context.config_ref().sort_option.clone();
for tab in context.tab_context_mut().iter_mut() {
let _ = tab.history_mut().reload(observer.dest_path(), &options);
let _ = tab.history_mut().reload(observer.src_path(), &options);