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

Add Hook: "Commit script while keeping the selected transforms" (輸入預變換上屏時保留已接受的候選) #924

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

xrq-phys
Copy link
Contributor

@xrq-phys xrq-phys commented Aug 8, 2024

Pull request

Feature

Add Commit script while keeping the transforms: when commit_script_text_keep_selection is called, the morphed input goes to the box instead of raw inputs with previously accepted transformations kept

Essential for Japanese Romaji-based input.

功能:當 commit_script_text_keep_selection 被調用時(例如:

  "editor/bindings/Return": commit_script_text_keep_selection

時按下 Return),可實現預變換輸入上屏時保留已選漢字

比較直接的應用是在使用 Rime 輸入日語時可以將 Romaji 預變換的假名上屏並保留已輸入的漢字。

E.g.

  • Raw: nyuuryokupuroguramu
  • Precompose: にゅうりょくぷろぐらむ
  • Accept transformation: にゅうりょく入力
    ⬇️ Press Return ⬇️
  • Puts: 入力ぷろぐらむ

Config used here: My customization of gkovacs/rime-japanese.

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

@mokapsing
Copy link
Contributor

editor

已经支持的功能,请在我发的链结指向的wiki中搜关键字 commit_script_text

@xrq-phys xrq-phys changed the title Add Hook: "Commit script while keeping the transforms" (選單中的輸入預變換上屏) Add Hook: "Commit script while keeping the selected transforms" (輸入預變換上屏時保留已接受的候選) Aug 10, 2024
@xrq-phys
Copy link
Contributor Author

抱歉我描述功能有誤:應為 commit script時保留已接受的漢字

因為製作日文輸入時經常需要進行假名半保留,所以需要在前半部分已經完成compose selection(漢字)的情況下對後半部分保留precompose的預變換(假名)

已經更新最上方的PR描述

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。我贊同這是目前沒有且需要增設的功能。但是具體名字似可商榷,不過我也沒有更好的提議。:-)

@xrq-phys
Copy link
Contributor Author

感謝!

如果 CommitScriptTextKeepSelection 過長的話或許可以縮短爲 CommitScriptWithSelection?

@lotem
Copy link
Member

lotem commented Aug 26, 2024

這個功能挺好的,不如讓 commit_script_text 默認這樣出字。
如果意圖是只上拼音文而不上候選字,那用家也不需要選字。

Do we need to keep that optional argument?
@xrq-phys
Copy link
Contributor Author

原來如此。

已修改成 commit_script_text 的默認行爲。
(目前保留了 editor::CommitScriptText(bool keep_selection) 的參數)

@lotem lotem merged commit 72564a7 into rime:master Aug 26, 2024
10 checks passed
@lotem
Copy link
Member

lotem commented Aug 26, 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.

4 participants