Skip to content

fix(composition): skip phony segments in GetScriptText#1051

Merged
ksqsf merged 1 commit intorime:masterfrom
pfeiwu:skip_phony
Aug 4, 2025
Merged

fix(composition): skip phony segments in GetScriptText#1051
ksqsf merged 1 commit intorime:masterfrom
pfeiwu:skip_phony

Conversation

@pfeiwu
Copy link
Contributor

@pfeiwu pfeiwu commented Aug 4, 2025

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

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

@ksqsf ksqsf requested a review from Copilot August 4, 2025 11:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and GetCommitText() methods

else if (cand && !cand->preedit().empty())
result += boost::erase_first_copy(cand->preedit(), "\t");
else
else if (!seg.HasTag("phony"))
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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))

Copilot uses AI. Check for mistakes.
Copy link
Member

@ksqsf ksqsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is potentially breaking though.

@ksqsf ksqsf merged commit 0a8a58f into rime:master Aug 4, 2025
10 checks passed
WindyValley pushed a commit to WindyValley/librime that referenced this pull request Nov 20, 2025
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.

4 participants