rime / ibus-rime

【中州韻】Rime for Linux/IBus
https://rime.im
GNU General Public License v3.0
718 stars 103 forks source link

[bug] speller/algebra rules affect all schemas that use the same dictionary #184

Closed rodrigomorales1 closed 1 month ago

rodrigomorales1 commented 1 month ago

Description of the bug

When two schemas use the same dictionary, the rules in the key speller/algebra in one schema also become part of the other schema.

In "Experiment 1" below, I created two schemas that used the same dictionary. The rules in speller/algebra in one of the schemas affected the other schema.

In "Experiment 2" below, I created two schemas that used different dictionaries. The rules in speller/algebra in one of the schemas didn't affect the other schema.

Experiment 1

I executed $ rm -rf ~/.config/ibus/rime && mkdir ~/.config/ibus/rime to remove all files in ~/.config/ibus/rime to avoid any other file interfer with this experiment.

~/.config/ibus/rime/my.dict.yaml (see code block below)

---
name: my
version: 1
sort: original
...
111 insertone
222 inserttwo
333 insertthree
444 insertfour

~/.config/ibus/rime/foo.schema.yaml (see code block below)

schema:
  schema_id: foo
  name: Schema foo
  version: 1

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - table_translator

speller:
  alphabet: "abcdefghijklmnopqrstuvwxyz"
  auto_select: false

translator:
  dictionary: my

key_binder:
  import_preset: default

~/.config/ibus/rime/bar.schema.yaml (see code block below)

schema:
  schema_id: bar
  name: Schema bar
  version: 1

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - table_translator

speller:
  alphabet: "abcdefghijklmnopqrstuvwxyz"
  algebra:
    - xform/insert/h/
  auto_select: false

translator:
  dictionary: my

key_binder:
  import_preset: default

default.custom.yaml (see code block below)

patch:
  schema_list:
  - schema: foo
  - schema: bar

I executed ibus-daemon -drx.

I opened gedit.

I pressed F4 to select the input method. I selected Schema foo. I pressed h and the candidate list was shown. This is unexpected behavior.

The screenshot below shows the behavior when using Schema foo and pressing h.

image

The screenshot below shows the behavior when using Schema bar and pressing h.

image

I believe this is unexpected behavior (i.e. it shouldn't happen) because in Schema foo, there is no input that starts with h. It seems that RIME mistakenly considers the rule speller/algebra from Schema bar. This situation doesn't happen when both schemas use separate dictionaries. See section "Experiment 2".

Experiment 2

As in the previous experiment, I executed $ rm -rf ~/.config/ibus/rime && mkdir ~/.config/ibus/rime to remove all files in ~/.config/ibus/rime to avoid any other file interfer with this experiment.

~/.config/ibus/rime/foo.dict.yaml (see code block below)

---
name: foo
version: 1
sort: original
...
111 insertone
222 inserttwo
333 insertthree
444 insertfour

~/.config/ibus/rime/foo.schema.yaml (see code block below)

schema:
  schema_id: foo
  name: Schema foo
  version: 1

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - table_translator

speller:
  alphabet: "abcdefghijklmnopqrstuvwxyz"
  auto_select: false

translator:
  dictionary: foo

key_binder:
  import_preset: default

~/.config/ibus/rime/bar.dict.yaml

---
name: bar
version: 1
sort: original
...
111 insertone
222 inserttwo
333 insertthree
444 insertfour

~/.config/ibus/rime/bar.schema.yaml (see code block below)

schema:
  schema_id: bar
  name: Schema bar
  version: 1

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - table_translator

speller:
  alphabet: "abcdefghijklmnopqrstuvwxyz"
  algebra:
    - xform/insert/h/
  auto_select: false

translator:
  dictionary: bar

key_binder:
  import_preset: default

~/.config/ibus/rime/default.custom.yaml (see code block below)

patch:
  schema_list:
  - schema: foo
  - schema: bar

I executed ibus-daemon -drx.

I opened gedit.

I pressed F4 to select the input method. I selected Schema foo. I pressed h and the candidate list was not shown. This is expected behavior.

The screenshot below shows the behavior when using Schema foo and pressing h.

image

The screenshot below shows the behavior when using Schema bar and pressing h.

image

System information

PS: Please let me know if (1) this is indeed a bug or (2) I have misunderstood some functionality of RIME.

lotem commented 1 month ago

to use different spelling for the shared dictionary, specify a different translator/prism identifier in each schema.

example:

https://github.com/rime/rime-double-pinyin/blob/master/double_pinyin.schema.yaml#L88