From e6ec1c7bca036c5114eb32d384c97a87a8ab5c43 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sat, 10 May 2025 17:37:20 +0200 Subject: [PATCH] fix debug mode crash sometimes occurring when deleting korean fixes GH-1551 --- .../keyboard/latin/inputlogic/InputLogic.java | 2 ++ .../java/helium314/keyboard/latin/InputLogicTest.kt | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java index 76fdf66c6..9deabf6d0 100644 --- a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java +++ b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java @@ -452,6 +452,8 @@ public final class InputLogic { // to the current word instead of considering the cursor position // position is actually not visible to the combiner, how to fix? processedEvent = mWordComposer.processEvent(hangulDecodedEvent); + if (event.getMKeyCode() == KeyCode.DELETE) + mWordComposer.resetInvalidCursorPosition(); } else { mWordComposer.setHangul(false); final boolean wasComposingWord = mWordComposer.isComposingWord(); diff --git a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt index 1fd8dea0b..afef5bbf0 100644 --- a/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt +++ b/app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt @@ -160,6 +160,16 @@ class InputLogicTest { assertEquals("ㅛ.", text) } + // see issue 1551 (debug only) + @Test fun deleteHangul() { + reset() + currentScript = ScriptUtils.SCRIPT_HANGUL + setText("ㅛㅛ ") + functionalKeyPress(KeyCode.DELETE) + functionalKeyPress(KeyCode.DELETE) + functionalKeyPress(KeyCode.DELETE) + } + @Test fun separatorUnselectsWord() { reset() setText("hello")