diff --git a/src/ui/grid.rs b/src/ui/grid.rs index 469c83a..b5099fc 100644 --- a/src/ui/grid.rs +++ b/src/ui/grid.rs @@ -15,6 +15,8 @@ const ROW_HEADER_WIDTH: u16 = 16; const COL_WIDTH: u16 = 10; const MIN_COL_WIDTH: u16 = 6; const MAX_COL_WIDTH: u16 = 32; +/// Subtle dark-gray background used to highlight the row containing the cursor. +const ROW_HIGHLIGHT_BG: Color = Color::Indexed(237); const GROUP_EXPANDED: &str = "▼"; const GROUP_COLLAPSED: &str = "▶"; @@ -322,14 +324,29 @@ impl<'a> GridWidget<'a> { let ri = data_row_idx; data_row_idx += 1; - let row_style = if ri == sel_row { + let is_sel_row = ri == sel_row; + let row_style = if is_sel_row { Style::default() .fg(Color::Cyan) + .bg(ROW_HIGHLIGHT_BG) .add_modifier(Modifier::BOLD) } else { Style::default() }; + // Paint row-highlight background across the entire row + // (data area + any trailing space) so gaps between columns + // and the margin after the last column share the highlight. + if is_sel_row { + let row_w = (area.x + area.width).saturating_sub(area.x); + buf.set_string( + area.x + ROW_HEADER_WIDTH, + y, + " ".repeat(row_w.saturating_sub(ROW_HEADER_WIDTH) as usize), + Style::default().bg(ROW_HIGHLIGHT_BG), + ); + } + // Multi-level row header — one sub-column per row category let mut hx = area.x; for d in 0..n_row_levels { @@ -392,6 +409,13 @@ impl<'a> GridWidget<'a> { .add_modifier(Modifier::BOLD) } else if is_search_match { Style::default().fg(Color::Black).bg(Color::Yellow) + } else if is_sel_row { + let fg = if value.is_none() { + Color::DarkGray + } else { + Color::White + }; + Style::default().fg(fg).bg(ROW_HIGHLIGHT_BG) } else if value.is_none() { Style::default().fg(Color::DarkGray) } else {