Fix completion menu jumping (#22780)

Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- Fix selected suggestion updating too many times when Zeta triggers

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Conrad Irwin 2025-01-07 23:48:52 -07:00 committed by GitHub
parent 0b361e5b7c
commit dffdf99228
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -334,6 +334,9 @@ impl CompletionsMenu {
entries
}
_ => {
if self.selected_item != 0 {
self.selected_item += 1;
}
let mut entries = Vec::with_capacity(self.entries.len() + 1);
entries.push(hint);
entries.extend_from_slice(&self.entries);
@ -341,9 +344,6 @@ impl CompletionsMenu {
}
}
.into();
if self.selected_item != 0 && self.selected_item + 1 < self.entries.len() {
self.selected_item += 1;
}
}
pub fn resolve_visible_completions(