|
|
@ -352,6 +352,7 @@ impl Prompt {
|
|
|
|
let prompt_color = theme.get("ui.text");
|
|
|
|
let prompt_color = theme.get("ui.text");
|
|
|
|
let completion_color = theme.get("ui.menu");
|
|
|
|
let completion_color = theme.get("ui.menu");
|
|
|
|
let selected_color = theme.get("ui.menu.selected");
|
|
|
|
let selected_color = theme.get("ui.menu.selected");
|
|
|
|
|
|
|
|
let suggestion_color = theme.get("ui.text.inactive");
|
|
|
|
// completion
|
|
|
|
// completion
|
|
|
|
|
|
|
|
|
|
|
|
let max_len = self
|
|
|
|
let max_len = self
|
|
|
@ -450,21 +451,29 @@ impl Prompt {
|
|
|
|
// render buffer text
|
|
|
|
// render buffer text
|
|
|
|
surface.set_string(area.x, area.y + line, &self.prompt, prompt_color);
|
|
|
|
surface.set_string(area.x, area.y + line, &self.prompt, prompt_color);
|
|
|
|
|
|
|
|
|
|
|
|
let input: Cow<str> = if self.line.is_empty() {
|
|
|
|
let (input, is_suggestion): (Cow<str>, bool) = if self.line.is_empty() {
|
|
|
|
// latest value in the register list
|
|
|
|
// latest value in the register list
|
|
|
|
self.history_register
|
|
|
|
match self
|
|
|
|
|
|
|
|
.history_register
|
|
|
|
.and_then(|reg| cx.editor.registers.last(reg))
|
|
|
|
.and_then(|reg| cx.editor.registers.last(reg))
|
|
|
|
.map(|entry| entry.into())
|
|
|
|
.map(|entry| entry.into())
|
|
|
|
.unwrap_or_else(|| Cow::from(""))
|
|
|
|
{
|
|
|
|
|
|
|
|
Some(value) => (value, true),
|
|
|
|
|
|
|
|
None => (Cow::from(""), false),
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
self.line.as_str().into()
|
|
|
|
(self.line.as_str().into(), false)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
surface.set_string(
|
|
|
|
surface.set_string(
|
|
|
|
area.x + self.prompt.len() as u16,
|
|
|
|
area.x + self.prompt.len() as u16,
|
|
|
|
area.y + line,
|
|
|
|
area.y + line,
|
|
|
|
&input,
|
|
|
|
&input,
|
|
|
|
prompt_color,
|
|
|
|
if is_suggestion {
|
|
|
|
|
|
|
|
suggestion_color
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
prompt_color
|
|
|
|
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|