@@ -237,8 +237,7 @@ impl Renderer {
237237
238238 pub fn render_prompt(&mut self, view: &View, prompt: &Prompt) {
239239 // completion
240− if prompt.completion.is_some() {
241− let completion = prompt.completion.clone().unwrap();
240+ if let Some(completion) = &prompt.completion {
242241 // TODO: find out better way of clearing individual lines of the screen
243242 for i in (3..7) {
244243 self.surface.set_string(
@@ -253,23 +252,16 @@ impl Renderer {
253252 view.theme.get("ui.statusline"),
254253 );
255254 for i in (0..completion.len()) {
255+ let color;
256256 if prompt.completion_selection_index.is_some()
257257 && i == prompt.completion_selection_index.unwrap()
258258 {
259− self.surface.set_string(
260− 1,
261− self.size.1 - 6 + i as u16,
262− &completion[i],
263− Style::default().bg(Color::Rgb(104, 060, 232)),
264− );
259+ color = Style::default().bg(Color::Rgb(104, 060, 232));
265260 } else {
266− self.surface.set_string(
267− 1,
268− self.size.1 - 6 + i as u16,
269− &completion[i],
270− self.text_color,
271− );
261+ color = self.text_color;
272262 }
263+ self.surface
264+ .set_string(1, self.size.1 - 6 + i as u16, &completion[i], color);
273265 }
274266 }
275267 // render buffer text
@@ -420,25 +412,18 @@ impl Application {
420412 ..
421413 }] = keys.as_slice()
422414 {
423− let command_list = vec![
424− String::from("q"),
425− String::from("aaa"),
426− String::from("bbb"),
427− String::from("ccc"),
428− ];
429−
430415 let prompt = Prompt::new(
431416 ":".to_owned(),
432417 |_input: &str| {
433418 let mut matches = vec![];
434419 // TODO: i need this duplicate list right now to avoid borrow checker issues
435− let placeholder_list = vec![
420+ let command_list = vec![
436421 String::from("q"),
437422 String::from("aaa"),
438423 String::from("bbb"),
439424 String::from("ccc"),
440425 ];
441− for command in placeholder_list {
426+ for command in command_list {
442427 if command.contains(_input) {
443428 matches.push(command);
444429 }
@@ -452,7 +437,6 @@ impl Application {
452437 "q" => editor.should_close = true,
453438 _ => (),
454439 },
455− command_list,
456440 );
457441
458442 self.prompt = Some(prompt);