Reload folder tree and git status using recursive watcher

This commit is contained in:
Jeremy Soller 2025-11-11 13:24:50 -07:00
parent f0adef5fa0
commit 449ff6b88c
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
2 changed files with 175 additions and 34 deletions

View file

@ -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()