From 13259b09396c61e6be063e65a1e5f2db7469a259 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Jun 2023 12:51:42 -0500 Subject: [PATCH] Fix style overwriting in table rows with multiple cells 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, so the call in the last cell would overwrite all prior cells. The block must be moved outside the for-loop over the cells. --- helix-tui/src/widgets/table.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index 97762167e848..3564871deec3 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -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,