rime / librime

Rime Input Method Engine, the core library
https://rime.im
BSD 3-Clause "New" or "Revised" License
3.37k stars 551 forks source link

Changing option via keyboard shortcut does not persist to user.yaml #818

Closed russell-liu closed 6 months ago

russell-liu commented 8 months ago

Describe the bug Changing (e.g. toggling) an option to be saved via the options menu successfully persists to user.yaml, and therefore persists when changing schemas or exiting and restarting Rime. The persistence fails when changing the option via a keyboard shortcut.

To Reproduce Below are high-level reproduction instructions on Weasel and detailed reproduction instructions with librime built from source on Linux (with build dependencies installed).

Weasel

session 1

session 2

Expected behavior On every platform, in session 2, on lines marked with !!!, the option should show as having been toggled, or on.

Flavor(please complete the following information): Select your flavor:

Package:

Additional context I have been able to fix the bug locally as follows: Comparing calls to Context::set_option in switch_translator.cc and key_binder.cc, those in switch_translator.cc are followed by a call to Config::SetBool whereas those in key_binder.cc are not. By adding similar statements to key_binder.cc, the bug is fixed. The logic needs to be fixed for all of radio_select_option, toggle_option, set_option, and unset_option; perhaps they can share a function which performs the persistence. I am unsure about how to contribute my fix to this project, but am happy to do so. Thank you!

lotem commented 7 months ago

目前的策略就是這樣. 參考其他主流中文輸入法, 快捷鍵做臨時的狀態切換. 而方案選單類似設置程序的作用.

lotem commented 7 months ago

不過這裏可能有 BUG: session 2 裏, 切換方案前後 full_shape 應當不變. 這不是通過保存到 user.yaml 實現的, 而是不清除或重置內存中的狀態. 除非方案裏指名要重置 (如 ascii_mode 通常在切換方案後重置爲 0).

lotem commented 7 months ago

退出 rime_api_console 進程後再運行就不是同一個 session 了.

russell-liu commented 6 months ago

Understood; thank you for your help. I guess the issue can be closed?