@@ -237,8 +237,7 @@ impl Renderer {
238 pub fn render_prompt(&mut self, view: &View, prompt: &Prompt) {
238 pub fn render_prompt(&mut self, view: &View, prompt: &Prompt) {
239 // completion
239 // completion
240− if prompt.completion.is_some() {
241− let completion = prompt.completion.clone().unwrap();
240+ if let Some(completion) = &prompt.completion {
242 // TODO: find out better way of clearing individual lines of the screen
241 // TODO: find out better way of clearing individual lines of the screen
243 for i in (3..7) {
242 for i in (3..7) {
244 self.surface.set_string(
243 self.surface.set_string(
@@ -253,23 +252,16 @@ impl Renderer {
253 view.theme.get("ui.statusline"),
252 view.theme.get("ui.statusline"),
255 for i in (0..completion.len()) {
254 for i in (0..completion.len()) {
256 if prompt.completion_selection_index.is_some()
256 if prompt.completion_selection_index.is_some()
257 && i == prompt.completion_selection_index.unwrap()
257 && i == prompt.completion_selection_index.unwrap()
259− self.surface.set_string(
261− self.size.1 - 6 + i as u16,
263− Style::default().bg(Color::Rgb(104, 060, 232)),
259+ color = Style::default().bg(Color::Rgb(104, 060, 232));
266− self.surface.set_string(
268− self.size.1 - 6 + i as u16,
270− self.text_color,
261+ color = self.text_color;
264+ .set_string(1, self.size.1 - 6 + i as u16, &completion[i], color);
275 // render buffer text
267 // render buffer text
@@ -420,25 +412,18 @@ impl Application {
421 }] = keys.as_slice()
413 }] = keys.as_slice()
423− let command_list = vec![
425− String::from("aaa"),
426− String::from("bbb"),
427− String::from("ccc"),
430 let prompt = Prompt::new(
415 let prompt = Prompt::new(
431 ":".to_owned(),
416 ":".to_owned(),
432 |_input: &str| {
417 |_input: &str| {
433 let mut matches = vec![];
418 let mut matches = vec![];
434 // TODO: i need this duplicate list right now to avoid borrow checker issues
419 // TODO: i need this duplicate list right now to avoid borrow checker issues
435− let placeholder_list = vec![
420+ let command_list = vec![
436 String::from("q"),
421 String::from("q"),
437 String::from("aaa"),
422 String::from("aaa"),
438 String::from("bbb"),
423 String::from("bbb"),
439 String::from("ccc"),
424 String::from("ccc"),
441− for command in placeholder_list {
426+ for command in command_list {
442 if command.contains(_input) {
427 if command.contains(_input) {
443 matches.push(command);
428 matches.push(command);
@@ -452,7 +437,6 @@ impl Application {
452 "q" => editor.should_close = true,
437 "q" => editor.should_close = true,
458 self.prompt = Some(prompt);
442 self.prompt = Some(prompt);