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
pull/649/head
Arijit Basu 11 months ago
parent d282032b3d
commit 9844ae1476
No known key found for this signature in database
GPG Key ID: 0F8EF5258DC38077

@ -669,6 +669,7 @@ fn draw_table<B: Backend>(
let header_height = app_config.general.table.header.height.unwrap_or(1); let header_height = app_config.general.table.header.height.unwrap_or(1);
let height: usize = let height: usize =
(layout_size.height.max(header_height + 2) - (header_height + 2)).into(); (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 let rows = app
.directory_buffer .directory_buffer
@ -767,17 +768,17 @@ fn draw_table<B: Backend>(
c.format.as_ref().map(|f| { c.format.as_ref().map(|f| {
let out = lua::call(lua, f, v.clone()) let out = lua::call(lua, f, v.clone())
.unwrap_or_else(|e| format!("{e:?}")); .unwrap_or_else(|e| format!("{e:?}"));
string_to_text(out) (string_to_text(out), c.style.to_owned())
}) })
}) })
.collect::<Vec<Text>>() .collect::<Vec<(Text, Style)>>()
}) })
.unwrap_or_default() .unwrap_or_default()
.iter() .into_iter()
.map(|x| Cell::from(x.to_owned())) .map(|(text, style)| Cell::from(text).style(style.into()))
.collect::<Vec<Cell>>(); .collect::<Vec<Cell>>();
Row::new(cols) Row::new(cols).style(row_style.to_owned().into())
}) })
.collect::<Vec<Row>>() .collect::<Vec<Row>>()
}) })
@ -878,7 +879,10 @@ fn draw_selection<B: Backend>(
.unwrap_or_else(|| n.absolute_path.clone()); .unwrap_or_else(|| n.absolute_path.clone());
string_to_text(out) string_to_text(out)
}) })
.map(ListItem::new) .map(|i| {
ListItem::new(i)
.style(app.config.general.selection.item.style.to_owned().into())
})
.collect(); .collect();
// Selected items // Selected items

Loading…
Cancel
Save