1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-07 12:20:39 -08:00

Report both sides of the region to the input method upon setup

* java/org/gnu/emacs/EmacsNative.java (getSelection): Return
array of ints.
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Adjust accordingly.
* src/androidterm.c (struct android_get_selection_context): New
field `mark'.
(android_get_selection): Set the mark field as appropriate.
(getSelection): Adjust accordingly.
This commit is contained in:
Po Lu 2023-02-19 19:56:51 +08:00
parent 0aa19e993b
commit 0998ab3ade
3 changed files with 38 additions and 11 deletions

View file

@ -205,7 +205,7 @@ public class EmacsNative
/* Return the current value of the selection, or -1 upon
failure. */
public static native int getSelection (short window);
public static native int[] getSelection (short window);
static
{

View file

@ -555,7 +555,8 @@ public class EmacsView extends ViewGroup
public InputConnection
onCreateInputConnection (EditorInfo info)
{
int selection, mode;
int mode;
int[] selection;
/* Figure out what kind of IME behavior Emacs wants. */
mode = getICMode ();
@ -575,7 +576,7 @@ public class EmacsView extends ViewGroup
/* If this fails or ANDROID_IC_MODE_NULL was requested, then don't
initialize the input connection. */
if (selection == -1 || mode == EmacsService.IC_MODE_NULL)
if (mode == EmacsService.IC_MODE_NULL || selection == null)
{
info.inputType = InputType.TYPE_NULL;
return null;
@ -585,8 +586,8 @@ public class EmacsView extends ViewGroup
info.imeOptions |= EditorInfo.IME_ACTION_DONE;
/* Set the initial selection fields. */
info.initialSelStart = selection;
info.initialSelEnd = selection;
info.initialSelStart = selection[0];
info.initialSelEnd = selection[1];
/* Create the input connection if necessary. */