Skip to content

Commit

Permalink
Fix style overwriting in table rows with multiple cells
Browse files Browse the repository at this point in the history
This is a fix for a subtle bug in the styling of cells in a table:
only the last Cell in the selected Row will display fuzzy-matching
highlights.

The simplest way to reproduce the bug is to open up the buffer picker.
Inputting a buffer ID number or a flag which is present like * should
highlight matched characters with your theme's 'ui.text.focus' scope,
but the styles are not applied.

The issue is that the block moved in this commit was called per-cell
but operates on the whole row's area. The block must be moved outside
the for-loop over the cells.
  • Loading branch information
the-mikedavis committed Jun 7, 2023
1 parent b394997 commit e2567cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helix-tui/src/widgets/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ impl<'a> Table<'a> {
} else {
col
};
if is_selected {
buf.set_style(table_row_area, self.highlight_style);
}
let mut col = table_row_start_col;
for (width, cell) in columns_widths.iter().zip(table_row.cells.iter()) {
if is_selected {
buf.set_style(table_row_area, self.highlight_style);
}
render_cell(
buf,
cell,
Expand Down

0 comments on commit e2567cb

Please sign in to comment.