Merge branch 'fix/arrow' into dev
This commit is contained in:
+19
-23
@@ -364,22 +364,22 @@ pub fn heading_bar(
|
|||||||
// Generate a block for the header, if the header is currently being used to sort a column, then highlight it white
|
// Generate a block for the header, if the header is currently being used to sort a column, then highlight it white
|
||||||
let header_block = |x: &Header| {
|
let header_block = |x: &Header| {
|
||||||
let mut color = Color::Black;
|
let mut color = Color::Black;
|
||||||
let mut suffix = "";
|
let mut prefix = "";
|
||||||
let mut suffix_margin = 0;
|
let mut prefix_margin = 0;
|
||||||
if let Some((a, b)) = data.sorted_by.as_ref() {
|
if let Some((a, b)) = data.sorted_by.as_ref() {
|
||||||
if x == a {
|
if x == a {
|
||||||
match b {
|
match b {
|
||||||
SortedOrder::Asc => suffix = " ▲",
|
SortedOrder::Asc => prefix = "▲ ",
|
||||||
SortedOrder::Desc => suffix = " ▼",
|
SortedOrder::Desc => prefix = "▼ ",
|
||||||
}
|
}
|
||||||
suffix_margin = 2;
|
prefix_margin = 2;
|
||||||
color = Color::White;
|
color = Color::White;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
Block::default().style(Style::default().bg(Color::Magenta).fg(color)),
|
Block::default().style(Style::default().bg(Color::Magenta).fg(color)),
|
||||||
suffix,
|
prefix,
|
||||||
suffix_margin,
|
prefix_margin,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -390,30 +390,26 @@ pub fn heading_bar(
|
|||||||
// Yes this is a mess, needs documenting correctly
|
// Yes this is a mess, needs documenting correctly
|
||||||
let text = match header {
|
let text = match header {
|
||||||
Header::State => format!(
|
Header::State => format!(
|
||||||
" {:>width$}{ic}",
|
" {x:>width$}",
|
||||||
header,
|
x = format!("{ic}{header}", ic = block.1),
|
||||||
ic = block.1,
|
width = width
|
||||||
width = width - block.2,
|
|
||||||
),
|
),
|
||||||
Header::Name => format!(
|
Header::Name => format!(
|
||||||
" {:>width$}{ic}",
|
" {x:>width$}",
|
||||||
header,
|
x = format!("{ic}{header}", ic = block.1),
|
||||||
ic = block.1,
|
width = width
|
||||||
width = width - block.2,
|
|
||||||
),
|
),
|
||||||
Header::Status => format!(
|
Header::Status => format!(
|
||||||
"{} {:>width$}{ic}",
|
"{} {x:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
header,
|
x = format!("{ic}{header}", ic = block.1),
|
||||||
ic = block.1,
|
width = width
|
||||||
width = width - block.2
|
|
||||||
),
|
),
|
||||||
_ => format!(
|
_ => format!(
|
||||||
"{}{:>width$}{ic}",
|
"{}{x:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
header,
|
x = format!("{ic}{header}", ic = block.1),
|
||||||
ic = block.1,
|
width = width
|
||||||
width = width - block.2
|
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
let count = u16::try_from(text.chars().count()).unwrap_or_default();
|
let count = u16::try_from(text.chars().count()).unwrap_or_default();
|
||||||
|
|||||||
Reference in New Issue
Block a user