aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorJan Hrastnik2020-10-20 21:02:02 +0000
committerJan Hrastnik2020-10-20 21:02:02 +0000
commit8f37c26f350b6409d7e13eb7fee4ef241dd4af5c (patch)
tree1d8338cf313aee3f391e8f53becc506b9af32038 /helix-term/src/application.rs
parentf3ddb8631f1e551fb3713c8eb20a0fdb2db2295d (diff)
completion highlighting
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs36
1 files changed, 28 insertions, 8 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 4e6123ae..75ebcb58 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -243,7 +243,7 @@ impl Renderer {
for i in (3..7) {
self.surface.set_string(
0,
- self.size.1 - i,
+ self.size.1 - i as u16,
" ".repeat(self.size.0 as usize),
self.text_color,
);
@@ -253,12 +253,23 @@ impl Renderer {
view.theme.get("ui.statusline"),
);
for i in (0..completion.len()) {
- self.surface.set_string(
- 1,
- self.size.1 - 6 + i as u16,
- &completion[i],
- self.text_color,
- )
+ if prompt.completion_selection_index.is_some()
+ && i == prompt.completion_selection_index.unwrap()
+ {
+ self.surface.set_string(
+ 1,
+ self.size.1 - 6 + i as u16,
+ &completion[i],
+ Style::default().bg(Color::Rgb(104, 060, 232)),
+ );
+ } else {
+ self.surface.set_string(
+ 1,
+ self.size.1 - 6 + i as u16,
+ &completion[i],
+ self.text_color,
+ );
+ }
}
}
// render buffer text
@@ -409,16 +420,24 @@ impl Application {
..
}] = keys.as_slice()
{
+ let command_list = vec![
+ String::from("q"),
+ String::from("aaa"),
+ String::from("bbb"),
+ String::from("ccc"),
+ ];
+
let prompt = Prompt::new(
":".to_owned(),
|_input: &str| {
+ let mut matches = vec![];
+ // TODO: i need this duplicate list right now to avoid borrow checker issues
let placeholder_list = vec![
String::from("q"),
String::from("aaa"),
String::from("bbb"),
String::from("ccc"),
];
- let mut matches = vec![];
for command in placeholder_list {
if command.contains(_input) {
matches.push(command);
@@ -433,6 +452,7 @@ impl Application {
"q" => editor.should_close = true,
_ => (),
},
+ command_list,
);
self.prompt = Some(prompt);