diff options
| author | Po Lu | 2023-02-22 14:59:27 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-22 14:59:27 +0800 |
| commit | 1e6f957c0dbb7e4a5e04c20fcb797be1d98df3d8 (patch) | |
| tree | 0a3919c992ec06af6163833486516f6c38476b5e /src | |
| parent | 8356412d6259a8fbfa83380ae0f96361d7223f03 (diff) | |
| download | emacs-1e6f957c0dbb7e4a5e04c20fcb797be1d98df3d8.tar.gz emacs-1e6f957c0dbb7e4a5e04c20fcb797be1d98df3d8.zip | |
Update Android port
* doc/emacs/input.texi (On-Screen Keyboards): Document changes
to text conversion.
* java/org/gnu/emacs/EmacsInputConnection.java (getExtractedText)
(EmacsInputConnection):
* src/keyboard.c (read_key_sequence): Disable text conversion
after reading prefix key.
* src/textconv.c (get_extracted_text): Fix returned value when
request length is zero.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 23 | ||||
| -rw-r--r-- | src/textconv.c | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 9532eb70f06..69fb8ae2797 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10053,6 +10053,13 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 10053 | /* Gets around Microsoft compiler limitations. */ | 10053 | /* Gets around Microsoft compiler limitations. */ |
| 10054 | bool dummyflag = false; | 10054 | bool dummyflag = false; |
| 10055 | 10055 | ||
| 10056 | #ifdef HAVE_TEXT_CONVERSION | ||
| 10057 | bool disabled_conversion; | ||
| 10058 | |||
| 10059 | /* Whether or not text conversion has already been disabled. */ | ||
| 10060 | disabled_conversion = false; | ||
| 10061 | #endif | ||
| 10062 | |||
| 10056 | struct buffer *starting_buffer; | 10063 | struct buffer *starting_buffer; |
| 10057 | 10064 | ||
| 10058 | /* List of events for which a fake prefix key has been generated. */ | 10065 | /* List of events for which a fake prefix key has been generated. */ |
| @@ -10202,6 +10209,22 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 10202 | echo_local_start = echo_length (); | 10209 | echo_local_start = echo_length (); |
| 10203 | keys_local_start = this_command_key_count; | 10210 | keys_local_start = this_command_key_count; |
| 10204 | 10211 | ||
| 10212 | #ifdef HAVE_TEXT_CONVERSION | ||
| 10213 | /* When reading a key sequence while text conversion is in | ||
| 10214 | effect, turn it off after the first character read. This | ||
| 10215 | makes input methods send actual key events instead. | ||
| 10216 | |||
| 10217 | Make sure only to do this once. */ | ||
| 10218 | |||
| 10219 | if (!disabled_conversion && t) | ||
| 10220 | { | ||
| 10221 | disable_text_conversion (); | ||
| 10222 | record_unwind_protect_void (resume_text_conversion); | ||
| 10223 | |||
| 10224 | disabled_conversion = true; | ||
| 10225 | } | ||
| 10226 | #endif | ||
| 10227 | |||
| 10205 | replay_key: | 10228 | replay_key: |
| 10206 | /* These are no-ops, unless we throw away a keystroke below and | 10229 | /* These are no-ops, unless we throw away a keystroke below and |
| 10207 | jumped back up to replay_key; in that case, these restore the | 10230 | jumped back up to replay_key; in that case, these restore the |
diff --git a/src/textconv.c b/src/textconv.c index 1ca5f0488f8..4b5f9e01162 100644 --- a/src/textconv.c +++ b/src/textconv.c | |||
| @@ -1462,6 +1462,9 @@ get_extracted_text (struct frame *f, ptrdiff_t n, | |||
| 1462 | /* Figure out the bounds of the text to return. */ | 1462 | /* Figure out the bounds of the text to return. */ |
| 1463 | if (n != -1) | 1463 | if (n != -1) |
| 1464 | { | 1464 | { |
| 1465 | /* Make sure n is at least 2. */ | ||
| 1466 | n = max (2, n); | ||
| 1467 | |||
| 1465 | start = PT - n / 2; | 1468 | start = PT - n / 2; |
| 1466 | end = PT + n - n / 2; | 1469 | end = PT + n - n / 2; |
| 1467 | } | 1470 | } |