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

@ -3,9 +3,9 @@ use tek_tui::ratatui::{style::{Color, Style}, prelude::Stylize};
use pad::PadStr;
pub struct Column<T> {
title: Arc<str>,
width: usize,
value: Box<dyn Fn(&T)->Option<Arc<str>> + Send + Sync>,
pub title: Arc<str>,
pub width: usize,
pub value: Box<dyn Fn(&T)->Option<Arc<str>> + Send + Sync>,
}
impl<T> Column<T> {
@ -101,6 +101,10 @@ impl<'a> Content<TuiOut> for TreeTable<'a> {
to.fill_bg(fill, Color::Rgb(192, 128, 0));
let fill = [area.x() + x as u16, y, w, 1];
to.fill_bg(fill, Color::Rgb(224, 192, 0));
if let Some((index, value)) = &self.0.editing {
let x = area.x() + if x > 0 { x + 1 } else { x } as u16;
to.blit(&value, x, y, None)
}
}
}
}