osfans / trime

同文安卓輸入法平臺3.x/Android-rime/Rime Input Method Engine for Android
http://osfans.github.io/trime/
GNU General Public License v3.0
3.18k stars 377 forks source link

Trime can't insert uppercase letters when mode "中文" is enabled #1476

Open rodrigomorales1 opened 2 months ago

rodrigomorales1 commented 2 months ago

摘要 / Summary

I'm not a native Chinese speaker and my Chinese level is not high enough to fully write this bug report in Chinese, so I'm writing it in English.

I'm trying to create a custom *.dict.yaml and a *.schema.yaml file. For the sake of simplicity, I have been able to reproduce the bug using a minimal *.dict.yaml file and a *.schema.yaml file. See section "Steps to Reproduce" below.

重现步骤 / Steps to Reproduce

I saved the contents of the code block below to /tmp/rime/foo.dict.yaml.

---
name: foo
version: 1
sort: original
...
111 i
222 io
333 iou

I saved the contents of the code block below to /tmp/rime/foo.schema.yaml.

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

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - matcher
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - echo_translator
  - punct_translator
  - script_translator
  - reverse_lookup_translator

speller:
  alphabet: "iou'"
  auto_select: false

translator:
  dictionary: foo
  enable_user_dict: false

key_binder:
  import_preset: default

I transferred the files mentioned above using the command shown below:

ssh samsung-galaxy-a02s 'rm -rf /sdcard/rime ; mkdir /sdcard/rime'

rsync -Psavv \
  /tmp/default.custom.yaml \
  /tmp/rime/foo.dict.yaml \
  /tmp/rime/foo.schema.yaml \
  samsung-galaxy-a02s:/sdcard/rime

After copying the files, the directory /sdcard/rime looked like this:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── foo.dict.yaml
        └── foo.schema.yaml

I opened Trime and I deployed. After the message "Deploying…" disappeared, I closed Trime. The directory /sdcard/rime looked like this:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── opencc
        └── user.yaml

I opened an application that allowed me to insert text so that the keyboard is shown. When the keyboard was shown, the schema "Schema foo" was enabled, I could insert lowercase letters (see video below.) This is expected behavior.

1-cut.webm

I could not insert uppercase letters when the mode "中文" is enabled (see video below.) This is unexpected behavior.

2-cut.webm

I could insert uppercase letters when the mode "西文" is enabled (see video below.) This is expected behavior.

3-cut.webm

预期行为 / Expected Behavior

Pressing on a uppercase letter should insert it when the mode 中文 is enabled.

I have two questions:

  1. Why I can't type uppercase letters when using "Schema foo" and "中文" (i.e. without having to switch to "西文")?

  2. How to type uppercase letters when using "Schema foo" and "中文" (i.e. without having to switch to "西文")?

日志 / Log

No response

截图 / Screenshot

No response

附加信息 / Additional Context

No response

系统版本 / OS Version

Android version 12

应用版本 / App Version

v3.3.0-0-g436c8fc4-release

构建信息 / Build Information

Builder: Release CI Git Repo: https://github.com/osfans/trime Build Git Hash: 436c8fc42af638fdd8744533beec03567ec03c6c Build Time: Sep 1, 2024 10:07:17 AM

Bambooin commented 2 months ago

You can try to reproduce with nightly build: https://github.com/osfans/trime/releases/tag/nightly

rodrigomorales1 commented 2 months ago

@Bambooin I just tried to reproduce it with nightly build:

I downloaded the file com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk from https://github.com/osfans/trime/releases/tag/nightly.

Changelog:

nightly-0-gfe9c39dc-release

Build Info:

Builder: Nightly CI
Git Repo: https://github.com/osfans/trime
Build Git Hash: fe9c39dc41d8c8d9596aded56b158e67659abb2c
Build Time: Sep 24, 2024 11:08:00 AM

I used the same files from my first message in this thread:

/tmp/rime/foo.dict.yaml

---
name: foo
version: 1
sort: original
...
111 i
222 io
333 iou

/tmp/rime/foo.schema.yaml

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

engine:
  processors:
  - ascii_composer
  - selector
  - key_binder
  - speller
  - selector
  - navigator
  - express_editor
  segmentors:
  - ascii_segmentor
  - matcher
  - abc_segmentor
  - punct_segmentor
  - fallback_segmentor
  translators:
  - echo_translator
  - punct_translator
  - script_translator
  - reverse_lookup_translator

speller:
  alphabet: "iou'"
  auto_select: false

translator:
  dictionary: foo
  enable_user_dict: false

key_binder:
  import_preset: default

/tmp/rime/default.custom.yaml (this is an empty file because I noticed that when the file default.custom.yaml doesn't exist, Trime shows the error "Enable schemata: No schema to enable. Make sure you have prelude and schema files in the user directory", so to avoid this error, I create an empty default.custom.yaml file)

I transferred the files using the command shown below:

ssh samsung-galaxy-a02s 'rm -rf /sdcard/rime ; mkdir /sdcard/rime'

rsync -Psavv \
  /tmp/default.custom.yaml \
  /tmp/rime/foo.dict.yaml \
  /tmp/rime/foo.schema.yaml \
  samsung-galaxy-a02s:/sdcard/rime

After transferring the files, the directory /sdcard/rime looked like this:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── foo.dict.yaml
        └── foo.schema.yaml

I launched Trime. I enabled the schemata "Schema foo" and I deployed. After the message "Deploying…" disappeared, I closed Trime. The directory /sdcard/rime looked like this:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── opencc
        └── user.yaml

I opened an application that allowed me to insert text so that the keyboard is shown (I opened the application "Simple Text Editor"). I tried inserting test TEST with the mode "中文" enabled, but I was only able to insert test, I could not insert TEST. See video below.

1-cut.webm

rodrigomorales1 commented 2 months ago

I thought that copying the files default.yaml, key_bindings.yaml, punctuation.yaml and symbols.yaml from rime-prelude and using nightly build would solve this problem, but it didn't. This is how the directory /sdcard/rime looks like after deploying:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── key_bindings.yaml
        ├── opencc
        ├── punctuation.yaml
        ├── symbols.yaml
        └── user.yaml

I am getting the same behavior: I can only insert lowercase letters, I can't insert uppercase letters. See video below.

1-cut.webm

Changelog:

nightly-0-gfe9c39dc-release

Build Info:

Builder: Nightly CI
Git Repo: https://github.com/osfans/trime
Build Git Hash: fe9c39dc41d8c8d9596aded56b158e67659abb2c
Build Time: Sep 24, 2024 11:08:00 AM
tumuyan commented 2 months ago

I think you could try to click the space key or enter key after input Test

rodrigomorales1 commented 2 months ago

@tumuyan I tried what you mentioned: I inserted TEST, then I pressed the space key (see first video below). I inserted TEST, then I pressed the enter key (see second video below).

Even if what you mentioned worked, I don't think that would be solution to the problem because, in my opinion, the user should not need to press the space key or the enter key for inserting uppercase letters. Pressing on an uppercase letter should have the same behavior as pressing in a lowercase letter: the letter is inserted in the cursor position.

1-cut.webm

2-cut.webm

Bambooin commented 2 months ago

I can't reproduce it from last nightly build.

I use tongwenfeng with https://github.com/Bambooin/rimerc

  1. Enable ASCII mode
  2. Input test
  3. Eable Chinese mode
  4. Toggle shift button
  5. Click T then click Enter
  6. Final result will be testT
rodrigomorales1 commented 2 months ago

@Bambooin I could not reproduce this bug in v3.2.19, but I could reproduce it in v3.3.0 and in Nightly Build. I noticed that the file tongwenfeng.trime.yaml is automatically created the first time Trime is launched in v3.2.19, but it is not automatically created in v3.3.0 or Nightly Build.

I suspect that v3.3.0 introduced some changes that suppressed the automatic creation of tongwenfeng.trime.yaml, so now users need to manually create the file tongwenfeng.trime.yaml. I have never manually created tongwenfeng.trime.yaml so I'd appreciate some guide on how to create it. Perhaps when that file exists, Trime v3.3.0 is able to insert uppercase letter as happens in v3.2.19.

In the paragraphs below, I explain my findings. If you need I provide more information, please let me know. I'm eager to help to solve this bug.

In all three experiments, I used these files:

/tmp/rime/foo.dict.yaml

---
name: foo
version: 1
sort: original
...
111 i
222 io
333 iou

/tmp/rime/foo.schema.yaml

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: "iou'"
  auto_select: false

translator:
  dictionary: foo
  enable_user_dict: false

key_binder:
  import_preset: default

/tmp/rime/default.custom.yaml (it's an empty file)

I cloned the rime-prelude repository using the command shown below:

cd /tmp/rime \
  && git clone --branch master --depth 1 'https://github.com/rime/rime-prelude'

I transferred the files from my desktop computer to my phone using the command shown below:

ssh samsung-galaxy-a02s 'rm -rf /sdcard/rime ; mkdir /sdcard/rime'

rsync -Psavv \
  /tmp/rime/foo.dict.yaml \
  /tmp/rime/foo.schema.yaml \
  /tmp/rime/default.custom.yaml \
  /tmp/rime/rime-prelude/default.yaml \
  /tmp/rime/rime-prelude/key_bindings.yaml \
  /tmp/rime/rime-prelude/punctuation.yaml \
  /tmp/rime/rime-prelude/symbols.yaml \
  samsung-galaxy-a02s:/sdcard/rime

Experiment: Use v3.2.19

I downloaded com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk from https://github.com/osfans/trime/releases/tag/v3.2.19

du -h ~/Downloads/com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk
sha512sum ~/Downloads/com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk
8.2M    /home/rodrigo/Downloads/com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk
83e677c6ef5a7c92209101cd26d00ff4c7ed187eda021e24259c32251ed59c97219e59747316d36eef35ec1b5a22d46b0242e04bc4d3833ca665085068c54496  /home/rodrigo/Downloads/com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk

The directory in my phone looked like this before deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── key_bindings.yaml
        ├── punctuation.yaml
        └── symbols.yaml

The directory in my phone looked like this after starting Trime for the first time and deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── key_bindings.yaml
        ├── opencc
        │   ├── hk2s.json
        │   ├── hk2t.json
        │   ├── HKVariants.ocd2
        │   ├── HKVariantsRev.ocd2
        │   ├── HKVariantsRevPhrases.ocd2
        │   ├── HKVariantsRevPhrases.txt
        │   ├── HKVariantsRev.txt
        │   ├── HKVariants.txt
        │   ├── jp2t.json
        │   ├── JPShinjitaiCharacters.ocd2
        │   ├── JPShinjitaiCharacters.txt
        │   ├── JPShinjitaiPhrases.ocd2
        │   ├── JPShinjitaiPhrases.txt
        │   ├── JPVariants.ocd2
        │   ├── JPVariants.txt
        │   ├── s2hk.json
        │   ├── s2t.json
        │   ├── s2tw.json
        │   ├── s2twp.json
        │   ├── STCharacters.ocd2
        │   ├── STCharacters.txt
        │   ├── STPhrases.ocd2
        │   ├── STPhrases.txt
        │   ├── t2hk.json
        │   ├── t2jp.json
        │   ├── t2s.json
        │   ├── t2tw.json
        │   ├── TSCharacters.ocd2
        │   ├── TSCharacters.txt
        │   ├── TSPhrases.ocd2
        │   ├── TSPhrases.txt
        │   ├── tw2s.json
        │   ├── tw2sp.json
        │   ├── tw2t.json
        │   ├── TWPhrases.ocd2
        │   ├── TWPhrasesRev.ocd2
        │   ├── TWPhrasesRev.txt
        │   ├── TWPhrases.txt
        │   ├── TWVariants.ocd2
        │   ├── TWVariantsRev.ocd2
        │   ├── TWVariantsRevPhrases.ocd2
        │   ├── TWVariantsRevPhrases.txt
        │   ├── TWVariantsRev.txt
        │   └── TWVariants.txt
        ├── punctuation.yaml
        ├── symbols.yaml
        ├── tongwenfeng.trime.yaml
        ├── trime.yaml
        └── user.yaml

The video below shows the behavior when using com.osfans.trime-v3.2.19-0-ge46046ab-armeabi-v7a-release.apk:

1-cut.webm

Experiment: Use v3.3.0

I downloaded com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk from https://github.com/osfans/trime/releases/tag/v3.3.0

du -h ~/Downloads/com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk
sha512sum ~/Downloads/com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk
8.5M    /home/rodrigo/Downloads/com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk
2abe1097cee9f6c26127cc7790744125b264a20f7a0b6ac0fa2bdf7d203be00b1c2b3da9d10d7c3f6fda341f84e394e3e21e881d7c102d4807b4e741ad48cdb3  /home/rodrigo/Downloads/com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk

The directory in my phone looked like this before deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── key_bindings.yaml
        ├── punctuation.yaml
        └── symbols.yaml

The directory in my phone looked like this after deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── key_bindings.yaml
        ├── opencc
        ├── punctuation.yaml
        ├── symbols.yaml
        └── user.yaml

The video below shows the behavior when using com.osfans.trime-v3.3.0-0-g436c8fc4-armeabi-v7a-release.apk:

2-cut.webm

Experiment: Use Nightly Build

I downloaded com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk from https://github.com/osfans/trime/releases/tag/nightly

du -h ~/Downloads/com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk
sha512sum ~/Downloads/com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk
8.5M    /home/rodrigo/Downloads/com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk
68d40cd262a31d32432eee9fe197779278db5791135e9e8fdff1148479e4fd023d62438514f1bdf32ec80281c7b39d6e6b6c5aae0e1b692829fdab84388dd8ed  /home/rodrigo/Downloads/com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk

The directory in my phone looked like this before deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── key_bindings.yaml
        ├── punctuation.yaml
        └── symbols.yaml

The directory in my phone looked like this after deploying:

ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── key_bindings.yaml
        ├── opencc
        ├── punctuation.yaml
        ├── symbols.yaml
        └── user.yaml

The video below shows the behavior when using com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk:

3-cut.webm

rodrigomorales1 commented 2 months ago

I thought that copying tongwenfeng.trime.yaml to /sdcard/rime before the first launch of Trime and before deploying would solve the issue, but it didn't, I can't type uppercase letter when the mode "中文" is enabled. The lines below described what I tried. I downloaded com.osfans.trime-nightly-0-gfe9c39dc-armeabi-v7a-release.apk from https://github.com/osfans/trime/releases/tag/nightly and installed it in my phone.

I cloned the rime-prelude and the trime repository using the commannd shown below:

rm -rf /tmp/rime \
  && mkdir /tmp/rime \
  && cd /tmp/rime \
  && git clone --branch master --depth 1 'https://github.com/rime/rime-prelude' \
  && git clone --branch develop --depth 1 'https://github.com/osfans/trime'

I created the file /tmp/rime/foo.dict.yaml with the following content:

---
name: foo
version: 1
sort: original
...
111 i
222 io
333 iou

I created the file /tmp/rime/foo.schema.yaml with the following content:

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: "iou'"
  auto_select: false

translator:
  dictionary: foo
  enable_user_dict: false

key_binder:
  import_preset: default

I created the file /tmp/rime/default.custom.yaml with the following content (an empty file):

I transferred the files from my desktop computer to my phone using the command shown below:

ssh samsung-galaxy-a02s 'rm -rf /sdcard/rime ; mkdir /sdcard/rime'

rsync -Psavv \
  /tmp/rime/trime/app/src/main/assets/shared/tongwenfeng.trime.yaml \
  /tmp/rime/foo.dict.yaml \
  /tmp/rime/foo.schema.yaml \
  /tmp/rime/default.custom.yaml \
  /tmp/rime/rime-prelude/default.yaml \
  /tmp/rime/rime-prelude/key_bindings.yaml \
  /tmp/rime/rime-prelude/punctuation.yaml \
  /tmp/rime/rime-prelude/symbols.yaml \
  samsung-galaxy-a02s:/sdcard/rime

The directory /sdcard/rime on my phone looked like this before deploying:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── key_bindings.yaml
        ├── punctuation.yaml
        ├── symbols.yaml
        └── tongwenfeng.trime.yaml

The directory /sdcard/rime on my phone looked like this after starting Trime for the first time, enabling the schema "Schema foo" and deploying:

$ ssh samsung-galaxy-a02s find /sdcard/rime | tree -a --fromfile --noreport
.
└── sdcard
    └── rime
        ├── build
        │   ├── default.yaml
        │   ├── foo.prism.bin
        │   ├── foo.reverse.bin
        │   ├── foo.schema.yaml
        │   ├── foo.table.bin
        │   └── trime.yaml
        ├── default.custom.yaml
        ├── default.yaml
        ├── foo.dict.yaml
        ├── foo.schema.yaml
        ├── installation.yaml
        ├── key_bindings.yaml
        ├── opencc
        ├── punctuation.yaml
        ├── symbols.yaml
        ├── tongwenfeng.trime.yaml
        └── user.yaml

I tried to insert uppercase letter with the mode "中文" enabled, but the uppercase letters were not inserted.

chaihahaha commented 1 month ago

I also found the same issue when using nightly and v3.3.0 with this modified tongwenfeng.trime.yaml.

chaihahaha commented 1 month ago

I can't reproduce it from last nightly build.

I use tongwenfeng with https://github.com/Bambooin/rimerc

  1. Enable ASCII mode
  2. Input test
  3. Eable Chinese mode
  4. Toggle shift button
  5. Click T then click Enter
  6. Final result will be testT

I cannot find tongwenfeng.trime.yaml in this repo. If you have a working configuration, I would like to compare it to mine and check which line is causing this issue.

chaihahaha commented 1 month ago

This issue could be solved by downgrading to v3.2.19.

WhiredPlanck commented 1 week ago

This issue may be fixed in the latest nightly version. In early this morning I pushed a fix that may workaround this.