|
|
@ -116,18 +116,18 @@ impl Prompt {
|
|
|
|
let max_col = area.width / BASE_WIDTH;
|
|
|
|
let max_col = area.width / BASE_WIDTH;
|
|
|
|
let col_height = ((self.completion.len() as u16 + max_col - 1) / max_col);
|
|
|
|
let col_height = ((self.completion.len() as u16 + max_col - 1) / max_col);
|
|
|
|
|
|
|
|
|
|
|
|
for i in (3..col_height + 3) {
|
|
|
|
// completion box area
|
|
|
|
surface.set_string(
|
|
|
|
let area = Rect::new(area.x, area.height - col_height - 2, area.width, col_height);
|
|
|
|
0,
|
|
|
|
let background = theme.get("ui.statusline");
|
|
|
|
area.height - i as u16,
|
|
|
|
|
|
|
|
" ".repeat(area.width as usize),
|
|
|
|
for y in area.top()..area.bottom() {
|
|
|
|
text_color,
|
|
|
|
for x in area.left()..area.right() {
|
|
|
|
);
|
|
|
|
let cell = surface.get_mut(x, y);
|
|
|
|
|
|
|
|
cell.reset();
|
|
|
|
|
|
|
|
cell.set_style(background);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
surface.set_style(
|
|
|
|
|
|
|
|
Rect::new(0, area.height - col_height - 2, area.width, col_height),
|
|
|
|
|
|
|
|
theme.get("ui.statusline"),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
for (i, (_range, completion)) in self.completion.iter().enumerate() {
|
|
|
|
for (i, (_range, completion)) in self.completion.iter().enumerate() {
|
|
|
|
let color = if Some(i) == self.completion_selection_index {
|
|
|
|
let color = if Some(i) == self.completion_selection_index {
|
|
|
|
Style::default().bg(Color::Rgb(104, 60, 232))
|
|
|
|
Style::default().bg(Color::Rgb(104, 60, 232))
|
|
|
@ -135,14 +135,14 @@ impl Prompt {
|
|
|
|
text_color
|
|
|
|
text_color
|
|
|
|
};
|
|
|
|
};
|
|
|
|
surface.set_stringn(
|
|
|
|
surface.set_stringn(
|
|
|
|
1 + col * BASE_WIDTH,
|
|
|
|
area.x + 1 + col * BASE_WIDTH,
|
|
|
|
area.height - col_height - 2 + row,
|
|
|
|
area.y + row,
|
|
|
|
&completion,
|
|
|
|
&completion,
|
|
|
|
BASE_WIDTH as usize - 1,
|
|
|
|
BASE_WIDTH as usize - 1,
|
|
|
|
color,
|
|
|
|
color,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
row += 1;
|
|
|
|
row += 1;
|
|
|
|
if row > col_height - 1 {
|
|
|
|
if row > area.height - 1 {
|
|
|
|
row = 0;
|
|
|
|
row = 0;
|
|
|
|
col += 1;
|
|
|
|
col += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|