Reload folder tree and git status using recursive watcher
This commit is contained in:
parent
f0adef5fa0
commit
449ff6b88c
2 changed files with 175 additions and 34 deletions
16
src/tab.rs
16
src/tab.rs
|
|
@ -6,7 +6,6 @@ use cosmic::{
|
|||
};
|
||||
use cosmic_files::mime_icon::{FALLBACK_MIME_ICON, mime_for_path, mime_icon};
|
||||
use cosmic_text::{Attrs, Buffer, Cursor, Edit, Selection, Shaping, SyntaxEditor, ViEditor, Wrap};
|
||||
use notify::Watcher;
|
||||
use regex::Regex;
|
||||
use std::{
|
||||
fs,
|
||||
|
|
@ -279,21 +278,6 @@ impl EditorTab {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn watch(&self, watcher_opt: &mut Option<notify::RecommendedWatcher>) {
|
||||
if let Some(path) = &self.path_opt {
|
||||
if let Some(watcher) = watcher_opt {
|
||||
match watcher.watch(path, notify::RecursiveMode::NonRecursive) {
|
||||
Ok(()) => {
|
||||
log::info!("watching {:?} for changes", path);
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("failed to watch {:?} for changes: {:?}", path, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn changed(&self) -> bool {
|
||||
let editor = self.editor.lock().unwrap();
|
||||
editor.changed()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue