From 51c844445dc5fd5e3259691c912271a9837a1005 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 11 Sep 2021 01:00:10 +0900 Subject: [PATCH] add reserved words --- src/components/completion.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/completion.rs b/src/components/completion.rs index a7b7859..c8b785c 100644 --- a/src/components/completion.rs +++ b/src/components/completion.rs @@ -11,7 +11,7 @@ use tui::{ Frame, }; -const RESERVED_WORDS: &[&str] = &["AND", "OR", "NOT", "NULL", "IS"]; +const RESERVED_WORDS: &[&str] = &["IN", "AND", "OR", "NOT", "NULL", "IS"]; pub struct CompletionComponent { key_config: KeyConfig, @@ -67,8 +67,9 @@ impl CompletionComponent { fn filterd_candidates(&self) -> impl Iterator { self.candidates.iter().filter(move |c| { - c.starts_with(self.word.to_lowercase().as_str()) - || c.starts_with(self.word.to_uppercase().as_str()) + (c.starts_with(self.word.to_lowercase().as_str()) + || c.starts_with(self.word.to_uppercase().as_str())) + && !self.word.is_empty() }) }