@@ -241,7 +241,12 @@ impl Renderer {
241 // completion
241 // completion
242 if !prompt.completion.is_empty() {
242 if !prompt.completion.is_empty() {
243 // TODO: find out better way of clearing individual lines of the screen
243 // TODO: find out better way of clearing individual lines of the screen
246+ let max_col = self.size.0 / BASE_WIDTH;
247+ let col_height = ((prompt.completion.len() as u16 + max_col - 1) / max_col);
244− for i in (3..7) {
249+ for i in (3..col_height + 3) {
245 self.surface.set_string(
250 self.surface.set_string(
247 self.size.1 - i as u16,
252 self.size.1 - i as u16,
@@ -250,14 +255,9 @@ impl Renderer {
252 self.surface.set_style(
257 self.surface.set_style(
253− Rect::new(0, self.size.1 - 6, self.size.0, 4),
258+ Rect::new(0, self.size.1 - col_height - 2, self.size.0, col_height),
254 view.theme.get("ui.statusline"),
259 view.theme.get("ui.statusline"),
258− let max_col: u16 = self.size.0 / BASE_WIDTH;
259− // TODO: this will crash if there are too many cols added
260− // TODO: set char limit
261 for (i, command) in prompt.completion.iter().enumerate() {
261 for (i, command) in prompt.completion.iter().enumerate() {
262 let color = if prompt.completion_selection_index.is_some()
262 let color = if prompt.completion_selection_index.is_some()
263 && i == prompt.completion_selection_index.unwrap()
263 && i == prompt.completion_selection_index.unwrap()
@@ -268,13 +268,13 @@ impl Renderer {
269 self.surface.set_stringn(
269 self.surface.set_stringn(
270 1 + col * BASE_WIDTH,
270 1 + col * BASE_WIDTH,
271− self.size.1 - 6 + row as u16,
271+ self.size.1 - col_height - 2 + row,
272 &command,
272 &command,
273 BASE_WIDTH as usize - 1,
273 BASE_WIDTH as usize - 1,
276 row += 1;
276 row += 1;
277− if row > 3 {
277+ if row > col_height - 1 {
279 col += 1;
279 col += 1;