aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorJonathan LEI2022-12-10 09:56:12 +0000
committerMichael Davis2022-12-17 19:59:05 +0000
commit24cd7f6adf7a46b8386583b17f01839eb592a2eb (patch)
treeefff4184b021c0a6aadd6fc347ee1ec53ce1b538 /helix-term/src
parent042d03269ecbe68e0461548bcf6918324c967bbb (diff)
Make prompt suggestions greyed out
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/prompt.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index b19b9a9f..5fb6745a 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -352,6 +352,7 @@ impl Prompt {
let prompt_color = theme.get("ui.text");
let completion_color = theme.get("ui.menu");
let selected_color = theme.get("ui.menu.selected");
+ let suggestion_color = theme.get("ui.text.inactive");
// completion
let max_len = self
@@ -450,21 +451,29 @@ impl Prompt {
// render buffer text
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
- self.history_register
+ match self
+ .history_register
.and_then(|reg| cx.editor.registers.last(reg))
.map(|entry| entry.into())
- .unwrap_or_else(|| Cow::from(""))
+ {
+ Some(value) => (value, true),
+ None => (Cow::from(""), false),
+ }
} else {
- self.line.as_str().into()
+ (self.line.as_str().into(), false)
};
surface.set_string(
area.x + self.prompt.len() as u16,
area.y + line,
&input,
- prompt_color,
+ if is_suggestion {
+ suggestion_color
+ } else {
+ prompt_color
+ },
);
}
}