1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-06-07 21:56:04 +02:00

added more completions per line

This commit is contained in:
Jan Hrastnik 2020-10-30 12:22:58 +01:00
parent 956173bcea
commit 28a1e11fda

View File

@ -251,17 +251,29 @@ pub fn render_prompt(&mut self, view: &View, prompt: &Prompt) {
Rect::new(0, self.size.1 - 6, self.size.0, 4),
view.theme.get("ui.statusline"),
);
let mut row = 0;
let mut col = 0;
// TODO: this will crash if there are too many cols added
// TODO: set char limit
for i in (0..completion.len()) {
let color;
if prompt.completion_selection_index.is_some()
let color = if prompt.completion_selection_index.is_some()
&& i == prompt.completion_selection_index.unwrap()
{
color = Style::default().bg(Color::Rgb(104, 060, 232));
Style::default().bg(Color::Rgb(104, 060, 232))
} else {
color = self.text_color;
self.text_color
};
self.surface.set_string(
1 + col * 10,
self.size.1 - 6 + row as u16,
&completion[i],
color,
);
row += 1;
if row > 3 {
row = 0;
col += 1;
}
self.surface
.set_string(1, self.size.1 - 6 + i as u16, &completion[i], color);
}
}
// render buffer text
@ -422,6 +434,8 @@ pub async fn event_loop(&mut self) {
String::from("aaa"),
String::from("bbb"),
String::from("ccc"),
String::from("ddd"),
String::from("eee"),
];
for command in command_list {
if command.contains(_input) {