From 9844ae1476ba1464699685169de7667a1eda3580 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Fri, 7 Jul 2023 15:13:51 +0530 Subject: [PATCH] Respect low priority styles - xplr.config.general.selection.item.style - xplr.config.general.table.row.style - xplr.config.general.table.row.cols[*].style - xplr.config.general.table.header.cols[*].style Ref: https://github.com/sayanarijit/xplr/issues/640 --- src/ui.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index 8151fd3..2673c19 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -669,6 +669,7 @@ fn draw_table( let header_height = app_config.general.table.header.height.unwrap_or(1); let height: usize = (layout_size.height.max(header_height + 2) - (header_height + 2)).into(); + let row_style = app_config.general.table.row.style.to_owned(); let rows = app .directory_buffer @@ -767,17 +768,17 @@ fn draw_table( c.format.as_ref().map(|f| { let out = lua::call(lua, f, v.clone()) .unwrap_or_else(|e| format!("{e:?}")); - string_to_text(out) + (string_to_text(out), c.style.to_owned()) }) }) - .collect::>() + .collect::>() }) .unwrap_or_default() - .iter() - .map(|x| Cell::from(x.to_owned())) + .into_iter() + .map(|(text, style)| Cell::from(text).style(style.into())) .collect::>(); - Row::new(cols) + Row::new(cols).style(row_style.to_owned().into()) }) .collect::>() }) @@ -878,7 +879,10 @@ fn draw_selection( .unwrap_or_else(|| n.absolute_path.clone()); string_to_text(out) }) - .map(ListItem::new) + .map(|i| { + ListItem::new(i) + .style(app.config.general.selection.item.style.to_owned().into()) + }) .collect(); // Selected items