1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 16:21:07 -08:00

Introduce an input method callback required by Android 34

* java/org/gnu/emacs/EmacsInputConnection.java (replaceText):
New function.

* java/org/gnu/emacs/EmacsNative.java (replaceText): Declare
native function.

* src/androidgui.h (enum android_ime_operation): New operation
ANDROID_IME_REPLACE_TEXT.

* src/androidterm.c (android_handle_ime_event): Decode text when
encountering an ANDROID_IME_REPLACE_TEXT operation.  Return if
decoding overflowed rather than presenting Qnil to textconv
functions.
(replaceText): New JNI function.

* src/frame.h (enum text_conversion_operation): New operation
TEXTCONV_REPLACE_TEXT.

* src/textconv.c (really_commit_text): Move point to start if
the composing region is set.
(really_replace_text): New function.
(handle_pending_conversion_events_1) <TEXTCONV_REPLACE_TEXT>:
New case.
(replace_text): New function.

* src/textconv.h: Update prototypes.
This commit is contained in:
Po Lu 2023-10-05 14:23:20 +08:00
parent 253f1aff1a
commit 123b77436e
7 changed files with 238 additions and 1 deletions

View file

@ -628,6 +628,21 @@ public final class EmacsInputConnection implements InputConnection
batchEditCount = 0;
}
@Override
public boolean
replaceText (int start, int end, CharSequence text,
int newCursorPosition, TextAttribute attributes)
{
if (EmacsService.DEBUG_IC)
Log.d (TAG, ("replaceText: " + text + ":: " + start + ","
+ end + "," + newCursorPosition));
EmacsNative.replaceText (windowHandle, start, end,
text.toString (), newCursorPosition,
attributes);
return true;
}
public void