allow columns to be resized

This commit is contained in:
🪞👃🪞 2025-03-10 12:15:14 +02:00
parent 23c3ce82b8
commit c3676e7b62

View file

@ -26,6 +26,20 @@ impl Handle<TuiIn> for Taggart {
let x_max = self.offset + self.size.h().saturating_sub(1);
let event = &*input.event();
match &self.editing {
None => match event {
press!(Up) => { self.cursor = self.cursor.saturating_sub(1); },
press!(Down) => { self.cursor = self.cursor + 1; },
press!(PageUp) => { self.cursor = self.cursor.saturating_sub(PAGE_SIZE); },
press!(PageDown) => { self.cursor += PAGE_SIZE; },
press!(Left) => { self.column = self.column.saturating_sub(1); },
press!(Right) => { self.column = self.column + 1; },
press!(Enter) => { self.edit_begin() },
press!(Char(' ')) => { open(&self.paths[self.cursor].path)?; }
press!(Char(']')) => { self.columns.0[self.column].width += 1; }
press!(Char('[')) => { self.columns.0[self.column].width =
self.columns.0[self.column].width.saturating_sub(1).max(5); }
_ => {}
},
Some(_value) => match event {
press!(Char(c)) => self.edit_insert(*c),
press!(Shift-Char(c)) => self.edit_insert(c.to_uppercase().next().unwrap()),
@ -35,17 +49,6 @@ impl Handle<TuiIn> for Taggart {
press!(Esc) => self.edit_confirm(),
_ => {}
},
None => match event {
press!(Up) => { self.cursor = self.cursor.saturating_sub(1); },
press!(Down) => { self.cursor = self.cursor + 1; },
press!(PageUp) => { self.cursor = self.cursor.saturating_sub(PAGE_SIZE); },
press!(PageDown) => { self.cursor += PAGE_SIZE; },
press!(Left) => { self.column = self.column.saturating_sub(1); },
press!(Right) => { self.column = self.column + 1; },
press!(Char(' ')) => { open(&self.paths[self.cursor].path)?; }
press!(Enter) => self.edit_begin(),
_ => {}
}
}
if self.cursor < x_min {
self.offset = self.cursor;