diff --git a/src/lsp.rs b/src/lsp.rs index e9624aa..d45a2c2 100644 --- a/src/lsp.rs +++ b/src/lsp.rs @@ -195,7 +195,8 @@ impl Backend { // prevent deleting puncts before real pinyin input let real_offset = new_offset + raw_input - .and_then(|rime_raw_input| new_input.borrow_pinyin().find(&rime_raw_input)) + .and_then(utils::option_string) + .and_then(|rime_raw_input| new_input.borrow_pinyin().rfind(&rime_raw_input)) .unwrap_or(0); // candidates to completions