mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 13:52:55 +03:00
allow parsing attributes from launcher labels
This commit is contained in:
parent
8f44dc46d9
commit
61f01f6ed7
@ -368,17 +368,27 @@ impl LauncherState {
|
|||||||
if row_num > max_items {
|
if row_num > max_items {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut attr = CellAttributes::blank();
|
||||||
|
|
||||||
if entry_idx == self.active_idx {
|
if entry_idx == self.active_idx {
|
||||||
changes.push(AttributeChange::Reverse(true).into());
|
changes.push(AttributeChange::Reverse(true).into());
|
||||||
|
attr.set_reverse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
let label = truncate_right(&entry.label, max_width);
|
|
||||||
if row_num < 9 && !self.filtering {
|
if row_num < 9 && !self.filtering {
|
||||||
changes.push(Change::Text(format!(" {}. {} \r\n", row_num + 1, label)));
|
changes.push(Change::Text(format!(" {}. ", row_num + 1)));
|
||||||
} else {
|
} else {
|
||||||
changes.push(Change::Text(format!(" {} \r\n", label)));
|
changes.push(Change::Text(" ".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut line = crate::tabbar::parse_status_text(&entry.label, attr.clone());
|
||||||
|
if line.cells().len() > max_width {
|
||||||
|
line.resize(max_width, termwiz::surface::SEQ_ZERO);
|
||||||
|
}
|
||||||
|
changes.append(&mut line.changes(&attr));
|
||||||
|
changes.push(Change::Text(" \r\n".to_string()));
|
||||||
|
|
||||||
if entry_idx == self.active_idx {
|
if entry_idx == self.active_idx {
|
||||||
changes.push(AttributeChange::Reverse(false).into());
|
changes.push(AttributeChange::Reverse(false).into());
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ impl TabBarState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_status_text(text: &str, default_cell: CellAttributes) -> Line {
|
pub fn parse_status_text(text: &str, default_cell: CellAttributes) -> Line {
|
||||||
let mut pen = default_cell.clone();
|
let mut pen = default_cell.clone();
|
||||||
let mut cells = vec![];
|
let mut cells = vec![];
|
||||||
let mut ignoring = false;
|
let mut ignoring = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user