Skip to content

Commit a30032c

Browse files
committed
fix: duplicated candidate in completion
Signed-off-by: wxiwnd <wxiwnd@outlook.com>
1 parent feca84c commit a30032c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ fn main() {
88
eprintln!("Usage: {} <pinyin>", args[0]);
99
std::process::exit(1);
1010
}
11+
let han_re = regex::Regex::new(r"\p{Han}").unwrap();
1112

1213
let input: &str = &args[1];
14+
if han_re.is_match(input) {return};
1315
let matcher = PinyinMatcher::builder(input)
1416
.pinyin_notations(PinyinNotation::Ascii | PinyinNotation::AsciiFirstLetter)
1517
.build();
1618

17-
let han_re = regex::Regex::new(r"\p{Han}").unwrap();
18-
1919
let stdin = std::io::stdin();
2020
let reader = BufReader::new(stdin.lock());
2121
for line_result in reader.lines() {

0 commit comments

Comments
 (0)