From a1d357a93966e992e2d2bfeab1f76e7acac1d17b Mon Sep 17 00:00:00 2001 From: Riey Date: Fri, 17 Sep 2021 13:18:05 +0900 Subject: [PATCH] Don't compose choseong when FlexibleComposeOrder is on (#524) * Add flexible_compose_check_jungseong test * Don't compose choseong when FlexibleComposeOrder is on * Update CHANGELOG --- docs/CHANGELOG.md | 3 ++- src/engine/backends/hangul/src/state.rs | 4 +--- src/engine/core/tests/sebeolsik_3_91.rs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a9486647..ce4e9d60 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,7 +8,8 @@ * Update dependencies [#508](https://github.com/Riey/kime/issues/508) * Fix sebeolsik-3sin-p2 '"' character [#509](https://github.com/Riey/kime/issues/509) -* Fix sebeolsik-391 "S-F" key [#509](https://github.com/Riey/kime/issues/521) +* Fix sebeolsik-391 "S-F" key [#521](https://github.com/Riey/kime/issues/521) +* Don't compose choseong when FlexibleComposeOrder is on [#520](https://github.com/Riey/kime/issues/520) ## 2.5.5 diff --git a/src/engine/backends/hangul/src/state.rs b/src/engine/backends/hangul/src/state.rs index a1169b9f..b27fc8c2 100644 --- a/src/engine/backends/hangul/src/state.rs +++ b/src/engine/backends/hangul/src/state.rs @@ -292,9 +292,7 @@ impl CharacterState { }) } else { match prev_cho.try_add(cho, addons) { - Some(new) - if addons.contains(Addon::FlexibleComposeOrder) || self.jung.is_none() => - { + Some(new) if self.jung.is_none() => { self.cho = Some(new); CharacterResult::Consume } diff --git a/src/engine/core/tests/sebeolsik_3_91.rs b/src/engine/core/tests/sebeolsik_3_91.rs index c867a4de..bf140c24 100644 --- a/src/engine/core/tests/sebeolsik_3_91.rs +++ b/src/engine/core/tests/sebeolsik_3_91.rs @@ -50,3 +50,16 @@ fn issue_521() { fn colon() { test_input(&[(Key::normal(Backslash), "", ":")]); } + +// https://github.com/Riey/kime/issues/520 +#[test] +fn flexible_compose_check_jungseong() { + test_input_with_addon( + &[ + (Key::normal(N), "ㅅ", ""), + (Key::normal(F), "사", ""), + (Key::normal(N), "ㅅ", "사"), + ], + Addon::FlexibleComposeOrder | Addon::ComposeChoseongSsang, + ); +}