mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-27 10:06:21 +00:00
fix some issues with korean input
This commit is contained in:
parent
48ad8efff5
commit
1640b53dfc
2 changed files with 13 additions and 9 deletions
|
@ -434,12 +434,14 @@ public final class InputLogic {
|
|||
mWordBeingCorrectedByCursor = null;
|
||||
mJustRevertedACommit = false;
|
||||
final Event processedEvent;
|
||||
Log.i("test", "cp "+event.getMCodePoint()+", code "+event.getMKeyCode());
|
||||
if (currentKeyboardScriptId == ScriptUtils.SCRIPT_HANGUL
|
||||
// only use the Hangul chain if codepoint may actually be Hangul
|
||||
// todo: this whole hangul-related logic should probably be somewhere else
|
||||
// need to use hangul combiner for whitespace, because otherwise the current word
|
||||
// seems to get deleted / replaced by space during mConnection.endBatchEdit()
|
||||
&& (event.getMCodePoint() >= 0x1100 || Character.isWhitespace(event.getMCodePoint()))) {
|
||||
// similar for functional keys (codePoint -1)
|
||||
&& (event.getMCodePoint() >= 0x1100 || Character.isWhitespace(event.getMCodePoint()) || event.getMCodePoint() == -1)) {
|
||||
mWordComposer.setHangul(true);
|
||||
final Event hangulDecodedEvent = HangulEventDecoder.decodeSoftwareKeyEvent(event);
|
||||
// todo: here hangul combiner does already consume the event, and appends typed codepoint
|
||||
|
|
|
@ -136,12 +136,12 @@ class InputLogicTest {
|
|||
@Test fun insertLetterIntoWordHangul() {
|
||||
reset()
|
||||
currentScript = ScriptUtils.SCRIPT_HANGUL
|
||||
setText("ㅛㅎㄹㅎㅕㅛ")
|
||||
chainInput("ㅛㅎㄹㅎㅕㅛ")
|
||||
setCursorPosition(3)
|
||||
input('ㄲ') // fails, as expected from the hangul issue when processing the event in onCodeInput
|
||||
assertEquals("ㅛㅎㄹㄲㅎㅕㅛ", getWordAtCursor())
|
||||
assertEquals("ㅛㅎㄹㄲㅎㅕㅛ", getText())
|
||||
assertEquals("ㅛㅎㄹㄲㅎㅕㅛ", textBeforeCursor + textAfterCursor)
|
||||
assertEquals("ㅛㅎㄹㄲ혀ㅛ", getWordAtCursor())
|
||||
assertEquals("ㅛㅎㄹㄲ혀ㅛ", getText())
|
||||
assertEquals("ㅛㅎㄹㄲ혀ㅛ", textBeforeCursor + textAfterCursor)
|
||||
assertEquals(4, getCursorPosition())
|
||||
assertEquals(4, cursor)
|
||||
}
|
||||
|
@ -525,10 +525,12 @@ class InputLogicTest {
|
|||
latinIME.onEvent(Event.createEventForCodePointFromUnknownSource(codePoint))
|
||||
handleMessages()
|
||||
|
||||
if (phantomSpaceToInsert.isEmpty())
|
||||
assertEquals(oldBefore + insert, textBeforeCursor)
|
||||
else // in some cases autospace might be suppressed
|
||||
assert(oldBefore + phantomSpaceToInsert + insert == textBeforeCursor || oldBefore + insert == textBeforeCursor)
|
||||
if (currentScript != ScriptUtils.SCRIPT_HANGUL) { // check fails if hangul combiner merges symbols
|
||||
if (phantomSpaceToInsert.isEmpty())
|
||||
assertEquals(oldBefore + insert, textBeforeCursor)
|
||||
else // in some cases autospace might be suppressed
|
||||
assert(oldBefore + phantomSpaceToInsert + insert == textBeforeCursor || oldBefore + insert == textBeforeCursor)
|
||||
}
|
||||
assertEquals(oldAfter, textAfterCursor)
|
||||
assertEquals(textBeforeCursor + textAfterCursor, getText())
|
||||
checkConnectionConsistency()
|
||||
|
|
Loading…
Add table
Reference in a new issue