fix(composition): skip phony segments in GetScriptText#1051
Merged
ksqsf merged 1 commit intorime:masterfrom Aug 4, 2025
Merged
fix(composition): skip phony segments in GetScriptText#1051ksqsf merged 1 commit intorime:masterfrom
ksqsf merged 1 commit intorime:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where phony segments were being included in the script text output when commit_script_text is configured. The change adds filtering to skip phony segments in GetScriptText(), making it consistent with the existing filtering logic in GetPreedit() and GetCommitText().
- Adds phony segment filtering to
GetScriptText()method - Aligns behavior with existing
GetPreedit()andGetCommitText()methods
| else if (cand && !cand->preedit().empty()) | ||
| result += boost::erase_first_copy(cand->preedit(), "\t"); | ||
| else | ||
| else if (!seg.HasTag("phony")) |
There was a problem hiding this comment.
[nitpick] Consider extracting the phony segment check into a constant or helper method since this same check appears in GetPreedit() and GetCommitText(). This would improve maintainability and reduce duplication.
Suggested change
| else if (!seg.HasTag("phony")) | |
| else if (!IsPhonySegment(seg)) |
ksqsf
approved these changes
Aug 4, 2025
Member
ksqsf
left a comment
There was a problem hiding this comment.
LGTM. This is potentially breaking though.
lotem
approved these changes
Aug 4, 2025
WindyValley
pushed a commit
to WindyValley/librime
that referenced
this pull request
Nov 20, 2025
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 #
Feature
问题:在 editor 配置了 commit_script_text 后,触发该操作时 phony segment 的 input 会被一起输出出来
我发现在 GetPreedit 和 GetCommitText 中都对 phony 进行了过滤,也许在 GetScriptText 里也应该这样做?
Unit test
Manual test
Code Review
Additional Info