Skip to content

Commit 9c388a5

Browse files
committed
[[ Bug 18395 ]] Handle return correctly in fileds on Android
This patch ensures that all key events are routed through `handleKey` in order to ensure that special key events like return are translated correctly and we only have one code path to send a key event to the engine.
1 parent 384238a commit 9c388a5

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

docs/notes/bugfix-18395.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix return key event handling in fields on Android

engine/src/java/com/runrev/android/Engine.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ else if (key.getAction() == KeyEvent.ACTION_MULTIPLE)
502502
// IM-2013-02-21: [[ BZ 10684 ]]
503503
// allow BaseInputConnection to do the handling of commitText(), etc
504504
// and instead catch the raw key events that are generated.
505-
if (key.getKeyCode() == KeyEvent.KEYCODE_UNKNOWN)
505+
if (t_key_code == KeyEvent.KEYCODE_UNKNOWN)
506506
{
507507
// handle string of chars
508508
CharSequence t_chars = key.getCharacters();
509509
for (int i = 0; i < t_chars.length(); i++)
510-
doKeyPress(0, t_chars.charAt(i), 0);
510+
handleKey(t_key_code, t_chars.charAt(i));
511511
}
512512
else
513513
{
@@ -548,10 +548,10 @@ void updateComposingText(CharSequence p_new)
548548

549549
// send backspaces
550550
for (int i = 0; i < t_current_length - t_match_length; i++)
551-
doKeyPress(0, 0, 0xff08);
551+
handleKey(KeyEvent.KEYCODE_DEL, 0);
552552
// send new text
553553
for (int i = t_match_length; i < t_new_length; i++)
554-
doKeyPress(0, p_new.charAt(i), 0);
554+
handleKey(KeyEvent.KEYCODE_UNKNOWN, p_new.charAt(i));
555555

556556
m_composing_text = p_new;
557557

0 commit comments

Comments
 (0)