v0.3.0 : menu d autocompletion - les barres verticales des menus en colonne unique (ex. completion de theme) prennent la couleur du cadre du theme
This commit is contained in:
+26
@@ -379,6 +379,16 @@ impl Highlighter for AmCompleter {
|
|||||||
bar
|
bar
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
} else if cells.len() == 3 {
|
||||||
|
// Single-column menu (no descriptions, e.g. the theme
|
||||||
|
// names): paint the bars and the name.
|
||||||
|
let bar = self.theme.get().frame("│");
|
||||||
|
Cow::Owned(format!(
|
||||||
|
"{}{}{}",
|
||||||
|
bar,
|
||||||
|
self.theme.get().acc(cells[1]),
|
||||||
|
bar
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Cow::Borrowed(candidate)
|
Cow::Borrowed(candidate)
|
||||||
}
|
}
|
||||||
@@ -1775,6 +1785,22 @@ mod tests {
|
|||||||
assert!(widths.iter().all(|w| *w == widths[0]), "unaligned box:\n{text}");
|
assert!(widths.iter().all(|w| *w == widths[0]), "unaligned box:\n{text}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn completion_menu_paints_single_column_bars() {
|
||||||
|
let c = completer();
|
||||||
|
c.set_theme(crate::theme::find("ocean").unwrap());
|
||||||
|
let row = "│ ocean │";
|
||||||
|
let out = c.highlight_candidate(row, rustyline::CompletionType::List);
|
||||||
|
assert!(
|
||||||
|
out.contains("\x1b[38;5;75m"),
|
||||||
|
"bars not painted with the frame color: {out}"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
out.contains("\x1b[1;38;5;81m"),
|
||||||
|
"name not painted with the accent color: {out}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn banner_top_border_right_dashes_keep_the_frame_color() {
|
fn banner_top_border_right_dashes_keep_the_frame_color() {
|
||||||
let session = test_session();
|
let session = test_session();
|
||||||
|
|||||||
Reference in New Issue
Block a user