-
Notifications
You must be signed in to change notification settings - Fork 614
Description
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
- choose any schema, A
- use options menu to toggle any option
- choose a different schema, B
- choose A
- verify that the option has been toggled
session 2
- choose any schema, A
- use keyboard shortcut to toggle any option
- choose a different schema, B
- choose A
- verify that the option has not been toggled!!!
librime on Linux (input into shell)
N.B. full_shape
is an option that needs to be saved
session 1
git clone https://github.com/rime/librime librime1
cd librime1
make
cd build/bin
./rime_api_console
{F4} # this shows that full_shape is currently off
2
3 # this toggles full_shape through options menu
{F4} # this shows that full_shape is currently on
exit
cat user.yaml # this shows that full_shape is currently on
./rime_api_console
{F4} # this shows that full_shape is currently on
session 2
git clone https://github.com/rime/librime librime2
cd librime2
make
cd build/bin
./rime_api_console
{F4} # this shows that full_shape is currently off
{Escape}
{Control+Shift+3} # this toggles full_shape through keyboard shortcut
{F4} # this shows that full_shape is currently on
exit
cat user.yaml # this shows that full_shape is currently off!!!
./rime_api_console
{F4} # this shows that full_shape is currently off!!!
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:
- ibus-rime
- fcitx-rime
- fcitx5-rime
- Squirrel
- Trime
- Weasel
Package:
- OS: Microsoft Windows 10 Home 10.0.19045 Build 19045
- Version: 0.15.0
- URI: https://github.com/rime/weasel/releases/download/0.15.0/weasel-0.15.0.0-installer.exe
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!