From 76a583e358b5924be1633056303b31ef3cac2415 Mon Sep 17 00:00:00 2001 From: Riey Date: Fri, 22 Oct 2021 01:48:58 +0900 Subject: [PATCH 1/2] Add `double_jongseong` failing test --- src/engine/core/tests/sebeolsik_3sin_p2.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/core/tests/sebeolsik_3sin_p2.rs b/src/engine/core/tests/sebeolsik_3sin_p2.rs index 1a3f812c..19357ca2 100644 --- a/src/engine/core/tests/sebeolsik_3sin_p2.rs +++ b/src/engine/core/tests/sebeolsik_3sin_p2.rs @@ -13,6 +13,11 @@ fn cu() { test_input(&[(Key::normal(O), "ㅊ", ""), (Key::normal(O), "추", "")]); } +#[test] +fn double_jongseong() { + test_input(&[(Key::normal(T), "ㅋ", ""), (Key::normal(T), "ㅋ", "ㅋ")]); +} + #[test] fn hello() { test_input(&[ From d67f35f6767a321fa5e105413ab6fd6a0472710a Mon Sep 17 00:00:00 2001 From: Riey Date: Fri, 22 Oct 2021 02:34:43 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20jongseong=20input=20bug=20`$=E3=85=8B?= =?UTF-8?q?=E3=85=95=20+=20$=E3=85=8B=E3=85=95=20=3D=20=E3=85=8B=E3=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 15 ++++----------- docs/CHANGELOG.md | 1 + src/engine/backends/hangul/src/state.rs | 14 ++++++++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 98cad392..fa8fb98a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,7 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { "type": "lldb", "request": "attach", @@ -18,18 +17,12 @@ "program": "/nix/store/xayryd4aps8pw1v3xwq5g2pzw3lif6kk-gedit-40.1/bin/.gedit-wrapped" }, { - "type": "lldb", + "type": "gdb", "request": "launch", "name": "Cargo test", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib" - ] - }, - "program": "${cargo:program}", - "args": [] + "target": "/home/riey/repos/kime/target/debug/deps/sebeolsik_3sin_p2-b3402d3703139896", + "cwd": "${workspaceRoot}" + // "arguments": "double_jongseong --exact --nocapture", }, { "type": "lldb", diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4204290b..274968c4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,6 +12,7 @@ * Fix preedit character error on chromium family [#535](https://github.com/Riey/kime/issues/535) * Let incomplete character can commit multiple jamos * Support johab encoding for preedit string +* Fix jongseong input bug `$ㅋㅕ + $ㅋㅕ = ㅋㅋ` ## 2.5.6 diff --git a/src/engine/backends/hangul/src/state.rs b/src/engine/backends/hangul/src/state.rs index 6070e0c1..59c19490 100644 --- a/src/engine/backends/hangul/src/state.rs +++ b/src/engine/backends/hangul/src/state.rs @@ -301,14 +301,20 @@ impl CharacterState { // 아 + $ㄴㅖ = 안 // ㅇ + $ㅜ + $ㅊㅔ = 웨 // ㅇ + ㅜ + $ㅊㅔ = 웇 - if self.jung.map_or(true, |j| { + // $ㅋ + $ㅋ$ㅕ = ㅋㅋ + + if self.cho.is_none() && self.jung.is_none() { + if first { + self.jung(jung, compose_jung, addons) + } else { + self.jong(jong, addons) + } + } else if self.jung.map_or(true, |j| { self.compose_jung && j.try_add(jung, addons).is_some() }) { self.jung(jung, compose_jung, addons) - } else if self.cho.is_some() || !first { - self.jong(jong, addons) } else { - self.jung(jung, compose_jung, addons) + self.jong(jong, addons) } }