mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 17:46:42 +01:00
mode indicator
This commit is contained in:
parent
acc2ce0ca2
commit
26d05e544b
3 changed files with 25 additions and 11 deletions
|
|
@ -14,12 +14,12 @@ impl<'a> Content<TuiOut> for TreeTable<'a> {
|
|||
}
|
||||
|
||||
impl<'a> TreeTable<'a> {
|
||||
const BG_COLUMN: Color = Color::Rgb(0, 0, 0);
|
||||
const FG_ROW: Color = Color::Rgb(0, 0, 0);
|
||||
const BG_ROW: Color = Color::Rgb(192, 128, 0);
|
||||
const BG_CELL: Color = Color::Rgb(224, 192, 0);
|
||||
const BG_EDIT: Color = Color::Rgb(48, 96, 0);
|
||||
const FG_EDIT: Color = Color::Rgb(255, 255, 255);
|
||||
pub(crate) const BG_COLUMN: Color = Color::Rgb(0, 0, 0);
|
||||
pub(crate) const FG_ROW: Color = Color::Rgb(0, 0, 0);
|
||||
pub(crate) const BG_ROW: Color = Color::Rgb(192, 128, 0);
|
||||
pub(crate) const BG_CELL: Color = Color::Rgb(224, 192, 0);
|
||||
pub(crate) const BG_EDIT: Color = Color::Rgb(48, 96, 0);
|
||||
pub(crate) const FG_EDIT: Color = Color::Rgb(255, 255, 255);
|
||||
fn rows (&self, to: &mut TuiOut, area: [u16;4], active_x: u16, active_w: u16) {
|
||||
for (row_index, row_y) in area.iter_y().enumerate() {
|
||||
let row_index_scrolled = row_index + self.0.offset;
|
||||
|
|
@ -32,7 +32,7 @@ impl<'a> TreeTable<'a> {
|
|||
to.area[1] = row_y;
|
||||
if selected {
|
||||
Self::row_cursor(to, area.x(), row_y, area.w());
|
||||
self.cell_cursor(to, area.x(), active_x, column_x, row_y, active_w);
|
||||
self.cell_cursor(to, area.x(), active_x, row_y, active_w);
|
||||
}
|
||||
self.row_data(to, entry, row_index_scrolled, &mut column_x);
|
||||
}
|
||||
|
|
@ -50,14 +50,14 @@ impl<'a> TreeTable<'a> {
|
|||
to.fill_fg(fill, Self::FG_ROW);
|
||||
to.fill_bg(fill, Self::BG_ROW);
|
||||
}
|
||||
fn cell_cursor (&self, to: &mut TuiOut, xa: u16, x0: u16, x: u16, y: u16, w: u16) {
|
||||
fn cell_cursor (&self, to: &mut TuiOut, xa: u16, x0: u16, y: u16, w: u16) {
|
||||
let fill = [xa + x0, y, w, 1];
|
||||
to.fill_bg(fill, Self::BG_CELL);
|
||||
}
|
||||
fn row_data (&self, to: &mut TuiOut, entry: &Entry, row: usize, x: &mut u16) {
|
||||
for (column_index, Column { width, getter, .. }) in self.0.columns.0.iter().enumerate() {
|
||||
to.area[0] = *x;
|
||||
if let Some((edit_index, value)) = self.0.editing.as_ref()
|
||||
if let Some((_edit_index, value)) = self.0.editing.as_ref()
|
||||
&& self.0.column == column_index
|
||||
&& self.0.cursor == row
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue