Skip to content

Commit 691ea41

Browse files
committed
fix problem with empty buffer
1 parent f25ede4 commit 691ea41

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/console.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,15 @@ pub(crate) fn recompute_predictions(
457457

458458
if recompute {
459459
let words = Shlex::new(&state.buf).collect::<Vec<_>>();
460+
let query = words.join(" ");
460461

461462
let suggestions = match &cache.commands_trie {
462-
Some(trie) => trie
463-
.predictive_search(words.join(" "))
463+
Some(trie) if !query.is_empty() => trie
464+
.predictive_search(query)
464465
.into_iter()
465466
.take(suggestion_count)
466467
.collect(),
467-
None => vec![],
468+
_ => vec![],
468469
};
469470
cache.predictions_cache = suggestions
470471
.into_iter()

0 commit comments

Comments
 (0)