@@ -241,7 +241,12 @@ impl Renderer {
241241 // completion
242242 if !prompt.completion.is_empty() {
243243 // TODO: find out better way of clearing individual lines of the screen
244− for i in (3..7) {
244+ let mut row = 0;
245+ let mut col = 0;
246+ let max_col = self.size.0 / BASE_WIDTH;
247+ let col_height = ((prompt.completion.len() as u16 + max_col - 1) / max_col);
248+
249+ for i in (3..col_height + 3) {
245250 self.surface.set_string(
246251 0,
247252 self.size.1 - i as u16,
@@ -250,14 +255,9 @@ impl Renderer {
250255 );
251256 }
252257 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),
254259 view.theme.get("ui.statusline"),
255260 );
256− let mut row = 0;
257− let mut col = 0;
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
261261 for (i, command) in prompt.completion.iter().enumerate() {
262262 let color = if prompt.completion_selection_index.is_some()
263263 && i == prompt.completion_selection_index.unwrap()
@@ -268,13 +268,13 @@ impl Renderer {
268268 };
269269 self.surface.set_stringn(
270270 1 + col * BASE_WIDTH,
271− self.size.1 - 6 + row as u16,
271+ self.size.1 - col_height - 2 + row,
272272 &command,
273273 BASE_WIDTH as usize - 1,
274274 color,
275275 );
276276 row += 1;
277− if row > 3 {
277+ if row > col_height - 1 {
278278 row = 0;
279279 col += 1;
280280 }