jdlorimer/chinese-support-redux

More issues related to Auto-Fill.

Opened this issue · 3 comments

The major bug is that at auto-filling just gets disabled altogether.

The other minor bug is that editing Pinyin tones is not working as expected and I often end up with something like 'hǎò'. As you can see a second tone mark was added, instead of replacing the first one. Related to this comes my third issue: Pinyin syllable are not being separated by auto-fill.

To Reproduce
To reproduce the first bug:

  1. Add a new Chinese card, here everything is still working.
  2. Now, while leaving the 'Add Card'-tab open, access the Anki browser and browse for some cards.
  3. Next go back to the 'Add'-tab and try input the next Character. You will see that auto-filling is not working anymore.
  4. To fix this you then need to close the 'Add'-tab and re-open it.

Expected behavior
For the first issue, I obviously expect auto-fill to keep functioning no matter how many other tabs of Anki or any other program I access.

To Reproduce
To reproduce the second bug:

  1. go to add a new card.
  2. Type in your Chinese character into the Hanzi field -> get your auto-fill Pinyin.
  3. When you have your Pinyin (i.e. hǎo), add a number from 1-4 to it (i.e. hǎo4)
  4. Let it auto-fill to change the Pinyin. This gets you the wrong Pinyin: i.e. hǎò instead of hào. I believe this is because the add-on treats it as two syllables rather than one (i.e. hǎ-ò).

To reproduce the third issue which I expect to be related to the second issue (above):

  1. go to add a new card.
  2. type in two Characters into the Hanzi field. (i.e. 正常)
  3. get your auto-fill. (i.e. zhèngcháng rather than zhèng cháng)

Expected behavior
I believe that the second and third issue are related. The add-on is not separating syllables clearly and thus unable to correctly adapt tone changes.

Specs:

  • OS: iOS
  • Anki Version [v2.1.5]
  • Chinese Support Version [0.13.0]

Additional context
Neither bug is returning a proper error-message and I have all other add-ons disabled.

hans commented

Hi, I'm experiencing the same issue ("first bug") but wasn't able to narrow down the exact trigger that stopped the auto-fill from working. I can confirm that opening the Browse window after opening the Add window, then returning to the Add window, triggers this.

Anki 2.1.11 (3cf770c7) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Linux
Chinese Support 0.13.0

The problem is that setupButton() function is called a second time in the edit.py which is overwriting self.editor. Afterwards when self.editor.loadNote() is called in the onFocusLost() function the self.editor class is not connected to the "add" window anymore and rather to the "browser" window.

In the moment I have no exact idea how to fix this problem.

Thanks to everyone for the detail in this report.

I'm just triaging issues at the moment, but at the very least I'll write a failing unit test for this on the weekend.