diff options
| author | Po Lu | 2023-02-15 22:51:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-15 22:51:44 +0800 |
| commit | cf24b61985c26cbf2e5a24cb0b64a8528aa3a9cc (patch) | |
| tree | b69f8dbb50e3e2f6f09caa05aecbee5241876f62 /java | |
| parent | dd7066901f67233c09f3b0409a57db7686c7ea5b (diff) | |
| download | emacs-cf24b61985c26cbf2e5a24cb0b64a8528aa3a9cc.tar.gz emacs-cf24b61985c26cbf2e5a24cb0b64a8528aa3a9cc.zip | |
Update Android port
* doc/emacs/input.texi (On-Screen Keyboards):
* doc/lispref/commands.texi (Misc Events): Improve documentation
of text conversion stuff.
* java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit)
(endBatchEdit, commitCompletion, commitText, deleteSurroundingText)
(finishComposingText, getSelectedText, getTextAfterCursor)
(EmacsInputConnection, setComposingRegion, performEditorAction)
(getExtractedText): Condition debug code on DEBUG_IC.
* java/org/gnu/emacs/EmacsService.java (EmacsService, updateIC):
Likewise.
* lisp/bindings.el (global-map):
* lisp/electric.el (global-map): Make `text-conversion'
`analyze-text-conversion'.
* lisp/progmodes/prog-mode.el (prog-mode): Enable text
conversion in input methods.
* lisp/simple.el (analyze-text-conversion): New function.
* lisp/textmodes/text-mode.el (text-conversion-style)
(text-mode): Likewise.
* src/androidterm.c (android_handle_ime_event): Handle
set_point_and_mark.
(android_sync_edit): Give Emacs 100 ms instead.
(android_perform_conversion_query): Skip the active region, not
the conversion region.
(getSelectedText): Implement properly.
(android_update_selection): Expose mark to input methods.
(android_reset_conversion): Handle `text-conversion-style'.
* src/buffer.c (init_buffer_once, syms_of_buffer): Add buffer
local variable `text-conversion-style'.
* src/buffer.h (struct buffer, bset_text_conversion_style): New
fields.
* src/emacs.c (android_emacs_init): Call syms_of_textconv.
* src/frame.h (enum text_conversion_operation): Rename
TEXTCONV_SET_POINT.
* src/lisp.h: Export syms_of_textconv.
* src/marker.c (set_marker_internal): Force redisplay when the
mark is set and the buffer is visible on builds that use text
conversion. Explain why.
* src/textconv.c (copy_buffer): Fix copying past gap.
(get_mark): New function.
(textconv_query): Implement new flag.
(sync_overlay): New function. Display conversion text in an
overlay.
(record_buffer_change, really_commit_text)
(really_set_composing_text, really_set_composing_region)
(really_delete_surrounding_text, really_set_point)
(handle_pending_conversion_events_1, decrement_inside)
(handle_pending_conversion_events, textconv_set_point)
(get_extracted_text, register_textconv_interface): Various fixes
and improvements.
* src/textconv.h (struct textconv_interface): Update
documentation.
* src/window.h (GCALIGNED_STRUCT): New field `prev_mark'.
* src/xdisp.c (mark_window_display_accurate_1): Handle
prev_mark.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsInputConnection.java | 68 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsService.java | 14 |
2 files changed, 59 insertions, 23 deletions
diff --git a/java/org/gnu/emacs/EmacsInputConnection.java b/java/org/gnu/emacs/EmacsInputConnection.java index 3cf4419838b..5eb56d5aa71 100644 --- a/java/org/gnu/emacs/EmacsInputConnection.java +++ b/java/org/gnu/emacs/EmacsInputConnection.java | |||
| @@ -55,7 +55,9 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 55 | public boolean | 55 | public boolean |
| 56 | beginBatchEdit () | 56 | beginBatchEdit () |
| 57 | { | 57 | { |
| 58 | Log.d (TAG, "beginBatchEdit"); | 58 | if (EmacsService.DEBUG_IC) |
| 59 | Log.d (TAG, "beginBatchEdit"); | ||
| 60 | |||
| 59 | EmacsNative.beginBatchEdit (windowHandle); | 61 | EmacsNative.beginBatchEdit (windowHandle); |
| 60 | return true; | 62 | return true; |
| 61 | } | 63 | } |
| @@ -64,7 +66,9 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 64 | public boolean | 66 | public boolean |
| 65 | endBatchEdit () | 67 | endBatchEdit () |
| 66 | { | 68 | { |
| 67 | Log.d (TAG, "endBatchEdit"); | 69 | if (EmacsService.DEBUG_IC) |
| 70 | Log.d (TAG, "endBatchEdit"); | ||
| 71 | |||
| 68 | EmacsNative.endBatchEdit (windowHandle); | 72 | EmacsNative.endBatchEdit (windowHandle); |
| 69 | return true; | 73 | return true; |
| 70 | } | 74 | } |
| @@ -73,7 +77,9 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 73 | public boolean | 77 | public boolean |
| 74 | commitCompletion (CompletionInfo info) | 78 | commitCompletion (CompletionInfo info) |
| 75 | { | 79 | { |
| 76 | Log.d (TAG, "commitCompletion: " + info); | 80 | if (EmacsService.DEBUG_IC) |
| 81 | Log.d (TAG, "commitCompletion: " + info); | ||
| 82 | |||
| 77 | EmacsNative.commitCompletion (windowHandle, | 83 | EmacsNative.commitCompletion (windowHandle, |
| 78 | info.getText ().toString (), | 84 | info.getText ().toString (), |
| 79 | info.getPosition ()); | 85 | info.getPosition ()); |
| @@ -84,7 +90,9 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 84 | public boolean | 90 | public boolean |
| 85 | commitText (CharSequence text, int newCursorPosition) | 91 | commitText (CharSequence text, int newCursorPosition) |
| 86 | { | 92 | { |
| 87 | Log.d (TAG, "commitText: " + text + " " + newCursorPosition); | 93 | if (EmacsService.DEBUG_IC) |
| 94 | Log.d (TAG, "commitText: " + text + " " + newCursorPosition); | ||
| 95 | |||
| 88 | EmacsNative.commitText (windowHandle, text.toString (), | 96 | EmacsNative.commitText (windowHandle, text.toString (), |
| 89 | newCursorPosition); | 97 | newCursorPosition); |
| 90 | return true; | 98 | return true; |
| @@ -94,8 +102,10 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 94 | public boolean | 102 | public boolean |
| 95 | deleteSurroundingText (int leftLength, int rightLength) | 103 | deleteSurroundingText (int leftLength, int rightLength) |
| 96 | { | 104 | { |
| 97 | Log.d (TAG, ("deleteSurroundingText: " | 105 | if (EmacsService.DEBUG_IC) |
| 98 | + leftLength + " " + rightLength)); | 106 | Log.d (TAG, ("deleteSurroundingText: " |
| 107 | + leftLength + " " + rightLength)); | ||
| 108 | |||
| 99 | EmacsNative.deleteSurroundingText (windowHandle, leftLength, | 109 | EmacsNative.deleteSurroundingText (windowHandle, leftLength, |
| 100 | rightLength); | 110 | rightLength); |
| 101 | return true; | 111 | return true; |
| @@ -105,7 +115,8 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 105 | public boolean | 115 | public boolean |
| 106 | finishComposingText () | 116 | finishComposingText () |
| 107 | { | 117 | { |
| 108 | Log.d (TAG, "finishComposingText"); | 118 | if (EmacsService.DEBUG_IC) |
| 119 | Log.d (TAG, "finishComposingText"); | ||
| 109 | 120 | ||
| 110 | EmacsNative.finishComposingText (windowHandle); | 121 | EmacsNative.finishComposingText (windowHandle); |
| 111 | return true; | 122 | return true; |
| @@ -115,7 +126,8 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 115 | public String | 126 | public String |
| 116 | getSelectedText (int flags) | 127 | getSelectedText (int flags) |
| 117 | { | 128 | { |
| 118 | Log.d (TAG, "getSelectedText: " + flags); | 129 | if (EmacsService.DEBUG_IC) |
| 130 | Log.d (TAG, "getSelectedText: " + flags); | ||
| 119 | 131 | ||
| 120 | return EmacsNative.getSelectedText (windowHandle, flags); | 132 | return EmacsNative.getSelectedText (windowHandle, flags); |
| 121 | } | 133 | } |
| @@ -124,27 +136,44 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 124 | public String | 136 | public String |
| 125 | getTextAfterCursor (int length, int flags) | 137 | getTextAfterCursor (int length, int flags) |
| 126 | { | 138 | { |
| 127 | Log.d (TAG, "getTextAfterCursor: " + length + " " + flags); | 139 | String string; |
| 140 | |||
| 141 | if (EmacsService.DEBUG_IC) | ||
| 142 | Log.d (TAG, "getTextAfterCursor: " + length + " " + flags); | ||
| 128 | 143 | ||
| 129 | return EmacsNative.getTextAfterCursor (windowHandle, length, | 144 | string = EmacsNative.getTextAfterCursor (windowHandle, length, |
| 130 | flags); | 145 | flags); |
| 146 | |||
| 147 | if (EmacsService.DEBUG_IC) | ||
| 148 | Log.d (TAG, " --> " + string); | ||
| 149 | |||
| 150 | return string; | ||
| 131 | } | 151 | } |
| 132 | 152 | ||
| 133 | @Override | 153 | @Override |
| 134 | public String | 154 | public String |
| 135 | getTextBeforeCursor (int length, int flags) | 155 | getTextBeforeCursor (int length, int flags) |
| 136 | { | 156 | { |
| 137 | Log.d (TAG, "getTextBeforeCursor: " + length + " " + flags); | 157 | String string; |
| 158 | |||
| 159 | if (EmacsService.DEBUG_IC) | ||
| 160 | Log.d (TAG, "getTextBeforeCursor: " + length + " " + flags); | ||
| 161 | |||
| 162 | string = EmacsNative.getTextBeforeCursor (windowHandle, length, | ||
| 163 | flags); | ||
| 164 | |||
| 165 | if (EmacsService.DEBUG_IC) | ||
| 166 | Log.d (TAG, " --> " + string); | ||
| 138 | 167 | ||
| 139 | return EmacsNative.getTextBeforeCursor (windowHandle, length, | 168 | return string; |
| 140 | flags); | ||
| 141 | } | 169 | } |
| 142 | 170 | ||
| 143 | @Override | 171 | @Override |
| 144 | public boolean | 172 | public boolean |
| 145 | setComposingText (CharSequence text, int newCursorPosition) | 173 | setComposingText (CharSequence text, int newCursorPosition) |
| 146 | { | 174 | { |
| 147 | Log.d (TAG, "setComposingText: " + newCursorPosition); | 175 | if (EmacsService.DEBUG_IC) |
| 176 | Log.d (TAG, "setComposingText: " + newCursorPosition); | ||
| 148 | 177 | ||
| 149 | EmacsNative.setComposingText (windowHandle, text.toString (), | 178 | EmacsNative.setComposingText (windowHandle, text.toString (), |
| 150 | newCursorPosition); | 179 | newCursorPosition); |
| @@ -155,7 +184,8 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 155 | public boolean | 184 | public boolean |
| 156 | setComposingRegion (int start, int end) | 185 | setComposingRegion (int start, int end) |
| 157 | { | 186 | { |
| 158 | Log.d (TAG, "setComposingRegion: " + start + " " + end); | 187 | if (EmacsService.DEBUG_IC) |
| 188 | Log.d (TAG, "setComposingRegion: " + start + " " + end); | ||
| 159 | 189 | ||
| 160 | EmacsNative.setComposingRegion (windowHandle, start, end); | 190 | EmacsNative.setComposingRegion (windowHandle, start, end); |
| 161 | return true; | 191 | return true; |
| @@ -165,7 +195,8 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 165 | public boolean | 195 | public boolean |
| 166 | performEditorAction (int editorAction) | 196 | performEditorAction (int editorAction) |
| 167 | { | 197 | { |
| 168 | Log.d (TAG, "performEditorAction: " + editorAction); | 198 | if (EmacsService.DEBUG_IC) |
| 199 | Log.d (TAG, "performEditorAction: " + editorAction); | ||
| 169 | 200 | ||
| 170 | EmacsNative.performEditorAction (windowHandle, editorAction); | 201 | EmacsNative.performEditorAction (windowHandle, editorAction); |
| 171 | return true; | 202 | return true; |
| @@ -175,7 +206,8 @@ public class EmacsInputConnection extends BaseInputConnection | |||
| 175 | public ExtractedText | 206 | public ExtractedText |
| 176 | getExtractedText (ExtractedTextRequest request, int flags) | 207 | getExtractedText (ExtractedTextRequest request, int flags) |
| 177 | { | 208 | { |
| 178 | Log.d (TAG, "getExtractedText: " + request + " " + flags); | 209 | if (EmacsService.DEBUG_IC) |
| 210 | Log.d (TAG, "getExtractedText: " + request + " " + flags); | ||
| 179 | 211 | ||
| 180 | return EmacsNative.getExtractedText (windowHandle, request, | 212 | return EmacsNative.getExtractedText (windowHandle, request, |
| 181 | flags); | 213 | flags); |
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index 855a738a30f..2acb3ead086 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java | |||
| @@ -88,6 +88,8 @@ public class EmacsService extends Service | |||
| 88 | /* Display metrics used by font backends. */ | 88 | /* Display metrics used by font backends. */ |
| 89 | public DisplayMetrics metrics; | 89 | public DisplayMetrics metrics; |
| 90 | 90 | ||
| 91 | public static final boolean DEBUG_IC = false; | ||
| 92 | |||
| 91 | @Override | 93 | @Override |
| 92 | public int | 94 | public int |
| 93 | onStartCommand (Intent intent, int flags, int startId) | 95 | onStartCommand (Intent intent, int flags, int startId) |
| @@ -612,10 +614,11 @@ public class EmacsService extends Service | |||
| 612 | int newSelectionEnd, int composingRegionStart, | 614 | int newSelectionEnd, int composingRegionStart, |
| 613 | int composingRegionEnd) | 615 | int composingRegionEnd) |
| 614 | { | 616 | { |
| 615 | Log.d (TAG, ("updateIC: " + window + " " + newSelectionStart | 617 | if (DEBUG_IC) |
| 616 | + " " + newSelectionEnd + " " | 618 | Log.d (TAG, ("updateIC: " + window + " " + newSelectionStart |
| 617 | + composingRegionStart + " " | 619 | + " " + newSelectionEnd + " " |
| 618 | + composingRegionEnd)); | 620 | + composingRegionStart + " " |
| 621 | + composingRegionEnd)); | ||
| 619 | window.view.imManager.updateSelection (window.view, | 622 | window.view.imManager.updateSelection (window.view, |
| 620 | newSelectionStart, | 623 | newSelectionStart, |
| 621 | newSelectionEnd, | 624 | newSelectionEnd, |
| @@ -626,7 +629,8 @@ public class EmacsService extends Service | |||
| 626 | public void | 629 | public void |
| 627 | resetIC (EmacsWindow window, int icMode) | 630 | resetIC (EmacsWindow window, int icMode) |
| 628 | { | 631 | { |
| 629 | Log.d (TAG, "resetIC: " + window); | 632 | if (DEBUG_IC) |
| 633 | Log.d (TAG, "resetIC: " + window); | ||
| 630 | 634 | ||
| 631 | window.view.setICMode (icMode); | 635 | window.view.setICMode (icMode); |
| 632 | window.view.imManager.restartInput (window.view); | 636 | window.view.imManager.restartInput (window.view); |