Skip to content

Commit

Permalink
fix(editor): Wrong fuzz logic in the Hsu keyboard layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed May 21, 2024
1 parent 1f0b85e commit 9821f7f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ assignees: ''
- [ ] Git tag and sign tag
- [ ] cargo publish
- [ ] Tag new release on GitHub
- [ ] Update website
- [ ] Send announcement
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
What's New in libchewing 0.8.2 (May 21, 2024)
---------------------------------------------------------

* Bug fixed
- Wrong Hsu (許氏) keyboard fuzz conversion (ㄍㄧ to ㄐㄧ and ㄍㄩ to ㄐㄩ)
(introduced in v0.8.0)


What's New in libchewing 0.8.1 (May 15, 2024)
---------------------------------------------------------

* Bug fixed
- Fail to build on aarch64 due to type mismatch. (introduced in v0.8.0)


What's New in libchewing 0.8.0 (May 14, 2024)
---------------------------------------------------------

Expand Down
5 changes: 3 additions & 2 deletions src/editor/zhuyin_layout/hsu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ impl SyllableEditor for Hsu {

// fuzzy ㄍㄧ to ㄐㄧ and ㄍㄩ to ㄐㄩ
match (self.syllable.initial(), self.syllable.medial()) {
(Some(Bopomofo::G), Some(Bopomofo::I)) | (Some(Bopomofo::J), Some(Bopomofo::I)) => {
self.syllable.update(Bopomofo::IU);
(Some(Bopomofo::G), Some(Bopomofo::I))
| (Some(Bopomofo::G), Some(Bopomofo::IU)) => {
self.syllable.update(Bopomofo::J);
}
_ => (),
}
Expand Down
16 changes: 16 additions & 0 deletions tests/test-bopomofo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,22 @@ void test_KB_HSU()
ok_preedit_buffer(ctx, "\xE7\x88\xBE" /* 爾 */);
chewing_clean_preedit_buf(ctx);

type_keystroke_by_string(ctx, "g");
ok_bopomofo_buffer(ctx, "ㄍ");
type_keystroke_by_string(ctx, "e");
ok_bopomofo_buffer(ctx, "ㄍㄧ");
type_keystroke_by_string(ctx, " ");
ok_preedit_buffer(ctx, "機"); /* convert "ㄍㄧ" to "ㄐㄧ" */
chewing_clean_preedit_buf(ctx);

type_keystroke_by_string(ctx, "g");
ok_bopomofo_buffer(ctx, "ㄍ");
type_keystroke_by_string(ctx, "u");
ok_bopomofo_buffer(ctx, "ㄍㄩ");
type_keystroke_by_string(ctx, " ");
ok_preedit_buffer(ctx, "居"); /* convert "ㄍㄩ" to "ㄐㄩ" */
chewing_clean_preedit_buf(ctx);

chewing_delete(ctx);
}

Expand Down

0 comments on commit 9821f7f

Please sign in to comment.