aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-02-19 19:56:51 +0800
committerPo Lu2023-02-19 19:56:51 +0800
commit0998ab3ade7caf2b163cd99a44b8a3f17be763d5 (patch)
tree32b41d400299eefa5f881e8beaaf7d8ae4f97bfe /java
parent0aa19e993b1603d9cadc47c172f998f4d89b9e49 (diff)
downloademacs-0998ab3ade7caf2b163cd99a44b8a3f17be763d5.tar.gz
emacs-0998ab3ade7caf2b163cd99a44b8a3f17be763d5.zip
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.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsNative.java2
-rw-r--r--java/org/gnu/emacs/EmacsView.java9
2 files changed, 6 insertions, 5 deletions
diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java
index aaac9446510..ef1a0e75a5c 100644
--- a/java/org/gnu/emacs/EmacsNative.java
+++ b/java/org/gnu/emacs/EmacsNative.java
@@ -205,7 +205,7 @@ public class EmacsNative
205 205
206 /* Return the current value of the selection, or -1 upon 206 /* Return the current value of the selection, or -1 upon
207 failure. */ 207 failure. */
208 public static native int getSelection (short window); 208 public static native int[] getSelection (short window);
209 209
210 static 210 static
211 { 211 {
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index 5ea8b0dcc0e..89f526853b2 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -555,7 +555,8 @@ public class EmacsView extends ViewGroup
555 public InputConnection 555 public InputConnection
556 onCreateInputConnection (EditorInfo info) 556 onCreateInputConnection (EditorInfo info)
557 { 557 {
558 int selection, mode; 558 int mode;
559 int[] selection;
559 560
560 /* Figure out what kind of IME behavior Emacs wants. */ 561 /* Figure out what kind of IME behavior Emacs wants. */
561 mode = getICMode (); 562 mode = getICMode ();
@@ -575,7 +576,7 @@ public class EmacsView extends ViewGroup
575 576
576 /* If this fails or ANDROID_IC_MODE_NULL was requested, then don't 577 /* If this fails or ANDROID_IC_MODE_NULL was requested, then don't
577 initialize the input connection. */ 578 initialize the input connection. */
578 if (selection == -1 || mode == EmacsService.IC_MODE_NULL) 579 if (mode == EmacsService.IC_MODE_NULL || selection == null)
579 { 580 {
580 info.inputType = InputType.TYPE_NULL; 581 info.inputType = InputType.TYPE_NULL;
581 return null; 582 return null;
@@ -585,8 +586,8 @@ public class EmacsView extends ViewGroup
585 info.imeOptions |= EditorInfo.IME_ACTION_DONE; 586 info.imeOptions |= EditorInfo.IME_ACTION_DONE;
586 587
587 /* Set the initial selection fields. */ 588 /* Set the initial selection fields. */
588 info.initialSelStart = selection; 589 info.initialSelStart = selection[0];
589 info.initialSelEnd = selection; 590 info.initialSelEnd = selection[1];
590 591
591 /* Create the input connection if necessary. */ 592 /* Create the input connection if necessary. */
592 593