switch between sequences; layout unfucking

This commit is contained in:
🪞👃🪞 2024-06-21 12:57:46 +03:00
parent c18aa2cbbd
commit 185c6b5b34
7 changed files with 253 additions and 201 deletions

View file

@ -31,7 +31,7 @@ impl Device for FocusColumn {
handle_focus(self, event, KEYMAP_FOCUS_COLUMN)
}
fn render (&self, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
let (rect, rects) = super::render_column(self.1.0.as_ref(), buf, area, )?;
let (rect, rects) = draw_column(self.1.0.as_ref(), buf, area, 0)?;
//if i == self.focus {
//if self.focused {
//draw_box_styled(buf, result, Some(Style::default().white().not_dim()))
@ -110,23 +110,25 @@ pub struct FocusRow(pub Option<usize>, pub Row);
impl Device for FocusRow {
fn handle (&mut self, event: &AppEvent) -> Usually<bool> {
handle_focus(self, event, keymap!(Self {
[Left, NONE, "focus_up", "focus row above",
|s: &mut Self|s.handle_focus(&FocusEvent::Backward)],
[Right, NONE, "focus_down", "focus row below",
|s: &mut Self|s.handle_focus(&FocusEvent::Forward)],
[Enter, NONE, "focus_down", "focus row below",
|s: &mut Self|s.handle_focus(&FocusEvent::Inward)],
[Esc, NONE, "focus_down", "focus row below",
|s: &mut Self|s.handle_focus(&FocusEvent::Outward)]
}))
handle_focus(self, event, KEYMAP_FOCUS_ROW)
}
fn render (&self, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
let (rect, rects) = super::render_row(&self.1.0, buf, area)?;
let (rect, rects) = draw_row(&self.1.0, buf, area, 0)?;
Ok(rect)
}
}
const KEYMAP_FOCUS_ROW: &'static [KeyBinding<FocusRow>] = keymap!(FocusRow {
[Left, NONE, "focus_up", "focus row above",
|s: &mut FocusRow|s.handle_focus(&FocusEvent::Backward)],
[Right, NONE, "focus_down", "focus row below",
|s: &mut FocusRow|s.handle_focus(&FocusEvent::Forward)],
[Enter, NONE, "focus_down", "focus row below",
|s: &mut FocusRow|s.handle_focus(&FocusEvent::Inward)],
[Esc, NONE, "focus_down", "focus row below",
|s: &mut FocusRow|s.handle_focus(&FocusEvent::Outward)]
});
impl Focus for FocusRow {
fn unfocus (&mut self) {
self.0 = None