mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 09:36:42 +01:00
wip: basic editing
This commit is contained in:
parent
b13ce4f0d0
commit
5336ee358a
4 changed files with 90 additions and 57 deletions
10
src/view.rs
10
src/view.rs
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue