Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: find raw_input from the end #21

Merged
merged 2 commits into from
Feb 23, 2024
Merged

fix: find raw_input from the end #21

merged 2 commits into from
Feb 23, 2024

Conversation

TwIStOy
Copy link
Contributor

@TwIStOy TwIStOy commented Feb 22, 2024

No description provided.

@wlh320
Copy link
Owner

wlh320 commented Feb 22, 2024

感谢!确实应该从右面匹配。

但是现在的写法还有点小问题,就是 raw_input 是空串的时候可以跳过判断,不然 rfind 会返回字符串长度,影响标点符号的输入了。

可以在前面加个判断

        let real_offset = new_offset
            + raw_input
                .and_then(utils::option_string)
                .and_then(|rime_raw_input| new_input.borrow_pinyin().rfind(&rime_raw_input))
                .unwrap_or(0);

@TwIStOy
Copy link
Contributor Author

TwIStOy commented Feb 22, 2024

fixed!

@wlh320 wlh320 merged commit 2d6e765 into wlh320:master Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants