summaryrefslogtreecommitdiffstats
path: root/src/app/refresher.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/refresher.rs')
-rw-r--r--src/app/refresher.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/app/refresher.rs b/src/app/refresher.rs
index 77ff6c1..99aea57 100644
--- a/src/app/refresher.rs
+++ b/src/app/refresher.rs
@@ -1,11 +1,11 @@
-use std::sync::mpsc::{self, TryRecvError};
+use std::sync::mpsc::{self, Sender, TryRecvError};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
use anyhow::Result;
-use crate::config::REFRESH_EVENT;
+use crate::event::FmEvents;
use crate::log_info;
/// Allows refresh if the current path has been modified externally.
@@ -28,19 +28,16 @@ impl Refresher {
/// Those events are interpreted as refresh requests.
/// It also listen to a receiver for quit messages.
///
- /// This will send periodically an `Key::AltPageUp` event to the terminal which requires a refresh.
- /// This keybind is reserved and can't be bound to anything.
- ///
/// Using Event::User(()) conflicts with skim internal which interpret this
/// event as a signal(1) and hangs the terminal.
- pub fn new(term: Arc<tuikit::term::Term>) -> Self {
+ pub fn new(fm_sender: Arc<Sender<FmEvents>>) -> Self {
let (tx, rx) = mpsc::channel();
let mut counter: u8 = 0;
let handle = thread::spawn(move || loop {
match rx.try_recv() {
Ok(_) | Err(TryRecvError::Disconnected) => {
log_info!("terminating refresher");
- let _ = term.show_cursor(true);
+ // let _ = term.show_cursor(true);
return;
}
Err(TryRecvError::Empty) => {}
@@ -49,7 +46,8 @@ impl Refresher {
thread::sleep(Duration::from_millis(100));
if counter >= Self::TEN_SECONDS_IN_DECISECONDS {
counter = 0;
- if term.send_event(REFRESH_EVENT).is_err() {
+ if fm_sender.send(FmEvents::Refresh).is_err() {
+ // if term.send_event(REFRESH_EVENT).is_err() {
break;
}
}