on master help sign in
added more completions per line
28a1e11Jan Hrastnik
helix-term/src/application.rs+20−6
@@ -251,17 +251,29 @@ impl Renderer {
251 Rect::new(0, self.size.1 - 6, self.size.0, 4),
251 Rect::new(0, self.size.1 - 6, self.size.0, 4),
252 view.theme.get("ui.statusline"),
252 view.theme.get("ui.statusline"),
253 );
253 );
254+ let mut row = 0;
255+ let mut col = 0;
256+ // TODO: this will crash if there are too many cols added
257+ // TODO: set char limit
254 for i in (0..completion.len()) {
258 for i in (0..completion.len()) {
255− let color;
256− if prompt.completion_selection_index.is_some()
259+ let color = if prompt.completion_selection_index.is_some()
257 && i == prompt.completion_selection_index.unwrap()
260 && i == prompt.completion_selection_index.unwrap()
258 {
261 {
259− color = Style::default().bg(Color::Rgb(104, 060, 232));
262+ Style::default().bg(Color::Rgb(104, 060, 232))
260 } else {
263 } else {
264+ self.text_color
265+ };
266+ self.surface.set_string(
267+ 1 + col * 10,
268+ self.size.1 - 6 + row as u16,
269+ &completion[i],
261− color = self.text_color;
270+ color,
271+ );
272+ row += 1;
273+ if row > 3 {
274+ row = 0;
275+ col += 1;
262 }
276 }
263− self.surface
264− .set_string(1, self.size.1 - 6 + i as u16, &completion[i], color);
265 }
277 }
266 }
278 }
267 // render buffer text
279 // render buffer text
@@ -422,6 +434,8 @@ impl Application {
422 String::from("aaa"),
434 String::from("aaa"),
423 String::from("bbb"),
435 String::from("bbb"),
424 String::from("ccc"),
436 String::from("ccc"),
437+ String::from("ddd"),
438+ String::from("eee"),
425 ];
439 ];
426 for command in command_list {
440 for command in command_list {
427 if command.contains(_input) {
441 if command.contains(_input) {