unify setters and deleters

This commit is contained in:
🪞👃🪞 2025-04-07 15:18:40 +03:00
parent 25ca263cd7
commit d1889481b1
5 changed files with 86 additions and 163 deletions

View file

@ -47,9 +47,9 @@ impl Handle<TuiIn> for Taggart {
press!(Right) => { self.column_select( 1); },
press!(Char('[')) => { self.column_resize(-1); },
press!(Char(']')) => { self.column_resize( 1); },
press!(Char('{')) => { self.column_collapse(true, 1); },
press!(Char('}')) => { self.column_collapse(false, -1); },
press!(Delete) => { self.clear() },
press!(Char('{')) => { self.column_collapse(true); self.column_select( 1); },
press!(Char('}')) => { self.column_collapse(false); self.column_select(-1); },
press!(Delete) => { self.edit_clear() },
press!(Enter) => { self.edit_begin() },
press!(Char(' ')) => { self.open_in_player()?; },
_ => {}
@ -61,9 +61,6 @@ impl Handle<TuiIn> for Taggart {
}
impl Taggart {
fn clear (&self) {
todo!("clear")
}
fn open_in_player (&self) -> Usually<()> {
open(self.entries[self.cursor].path.as_ref())?;
Ok(())
@ -78,9 +75,8 @@ impl Taggart {
let column = &mut self.columns.0[self.column];
column.width = ((column.width as isize) + amount).max(0) as usize;
}
fn column_collapse (&mut self, value: bool, next: isize) {
fn column_collapse (&mut self, value: bool) {
let column = &mut self.columns.0[self.column];
column.collapsed = value;
self.column = ((self.column as isize) + next).max(0) as usize;
}
}