diff --git a/src/repl.rs b/src/repl.rs index e90130b..f109326 100644 --- a/src/repl.rs +++ b/src/repl.rs @@ -379,6 +379,16 @@ impl Highlighter for AmCompleter { 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 { Cow::Borrowed(candidate) } @@ -1775,6 +1785,22 @@ mod tests { 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] fn banner_top_border_right_dashes_keep_the_frame_color() { let session = test_session();