diff options
author | qkzk <qkzk@users.noreply.github.com> | 2024-03-06 17:37:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 17:37:43 +0100 |
commit | 09a4135c804f28ded45e38bcb6f6dd21f30416f9 (patch) | |
tree | cb5607f749320964a422ce512996d923b44be5a6 /src/app/refresher.rs | |
parent | 0c669840cac86bdf59074d643d56a6ff3554c3cd (diff) | |
parent | 809448520c282f30d748e02499ddb13915e9c34b (diff) |
V0.1.26 search
Diffstat (limited to 'src/app/refresher.rs')
-rw-r--r-- | src/app/refresher.rs | 14 |
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; } } |