feat(api): add RimeCandidatePreview for inline preedit - #1208
Merged
Conversation
lotem
requested changes
Aug 9, 2026
ecstasoy
force-pushed
the
feat/candidate-preview-api
branch
from
August 9, 2026 08:03
df185e2 to
d7ba373
Compare
lotem
reviewed
Aug 9, 2026
lotem
left a comment
Member
There was a problem hiding this comment.
Thanks, please take another look.
|
|
||
| Bool (*change_page)(RimeSessionId session_id, Bool backward); | ||
|
|
||
| //! get the candidate preview at an absolute candidate index |
ecstasoy
force-pushed
the
feat/candidate-preview-api
branch
from
August 9, 2026 12:36
d7ba373 to
8cc1964
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Issue tracker
Fixes will automatically close the related issue
Fixes #1163
Feature
The alignment between the raw preedit input and the candidate text is only known accurately inside librime; a frontend cannot reliably reconstruct it from the outside. That reconstruction is the root cause of a recurring class of crashes — rime/squirrel#1041 / rime/squirrel#1045 / rime/squirrel#1047 / rime/squirrel#1081 — where the preedit offsets (e.g. pinyin) and the Han-character commit_text_preview don't line up.
This exposes a new CandidatePreview API that returns the text a candidate would commit, already split at the selection boundary into three parts:
Unit test
Manual test
Code Review
Additional Info
The Old Approach
After:
已在本地自行编译并将使用新API的鼠须管作为日常输入法使用过一段时间,测试过不同方案(魔然/雾凇/默认),上述issue均不再复现,也没有发现其他问题。