wip: basic editing

This commit is contained in:
🪞👃🪞 2025-03-09 05:12:56 +02:00
parent b13ce4f0d0
commit 5336ee358a
4 changed files with 90 additions and 57 deletions

View file

@ -41,37 +41,3 @@ fn main () -> Usually<()> {
let state = Arc::new(RwLock::new(Taggart::new(&path)?));
Tui::new()?.run(&state)
}
impl Taggart {
fn new (root: &impl AsRef<Path>) -> Usually<Self> {
Ok(Self {
_root: root.as_ref().into(),
paths: Self::collect(root)?,
cursor: 0,
offset: 0,
column: 0,
size: Measure::new(),
editing: None,
columns: Columns::default(),
})
}
fn collect (root: &impl AsRef<Path>) -> Usually<Vec<Entry>> {
let mut paths = vec![];
for entry in WalkDir::new(&root).into_iter()
.filter_entry(|e|!e.file_name().to_str().map(|s|s.starts_with(".")).unwrap_or(false))
{
let entry = entry?;
if entry.depth() == 0 {
continue
}
if let Some(entry) = Entry::new(root, &entry)? {
paths.push(entry);
}
}
paths.sort();
Ok(paths)
}
}