diff options
| author | Po Lu | 2023-08-21 16:02:53 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-21 16:03:54 +0800 |
| commit | 722559155df8c817bfb416e2e5101f7917a3b87d (patch) | |
| tree | e339e0670e8a8001b65fbe68fd5a07c3b680c99f /src/androidterm.c | |
| parent | 18c85306ac211402e4772bdb94b63d300a2ac119 (diff) | |
| download | emacs-722559155df8c817bfb416e2e5101f7917a3b87d.tar.gz emacs-722559155df8c817bfb416e2e5101f7917a3b87d.zip | |
; Adjust commentary
* src/androidterm.c (android_text_to_string)
(android_update_selection, android_reset_conversion)
(android_set_build_fingerprint): Refine wording in commentary
and correct typos.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index 473bea76ef5..a60dd50e5db 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -4932,14 +4932,16 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n, | |||
| 4932 | eassert (CHAR_HEAD_P (*buffer)); | 4932 | eassert (CHAR_HEAD_P (*buffer)); |
| 4933 | encoded = STRING_CHAR ((unsigned char *) buffer); | 4933 | encoded = STRING_CHAR ((unsigned char *) buffer); |
| 4934 | 4934 | ||
| 4935 | /* Now figure out how to save ENCODED into the string. | 4935 | /* Now establish how to save ENCODED into the string. |
| 4936 | Emacs operates on multibyte characters, not UTF-16 | 4936 | Emacs operates on multibyte characters, not UTF-16 characters |
| 4937 | characters with surrogate pairs as Android does. | 4937 | with surrogate pairs as Android does. |
| 4938 | 4938 | ||
| 4939 | However, character positions in Java are represented in 2 | 4939 | However, character positions in Java are represented as |
| 4940 | byte units, meaning that the text position reported to | 4940 | character (rather than codepoint) indices into UTF-16 |
| 4941 | Android can become out of sync if characters are found in a | 4941 | strings, meaning that text positions reported to Android can |
| 4942 | buffer that require surrogate pairs. | 4942 | become decoupled from their actual values if the text |
| 4943 | returned incorporates characters that must be encoded as | ||
| 4944 | surrogate pairs. | ||
| 4943 | 4945 | ||
| 4944 | The hack used by Emacs is to simply replace each multibyte | 4946 | The hack used by Emacs is to simply replace each multibyte |
| 4945 | character that doesn't fit in a jchar with the NULL | 4947 | character that doesn't fit in a jchar with the NULL |
| @@ -5940,9 +5942,9 @@ NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jshort window) | |||
| 5940 | 5942 | ||
| 5941 | #ifdef __clang__ | 5943 | #ifdef __clang__ |
| 5942 | #pragma clang diagnostic pop | 5944 | #pragma clang diagnostic pop |
| 5943 | #else | 5945 | #else /* GCC */ |
| 5944 | #pragma GCC diagnostic pop | 5946 | #pragma GCC diagnostic pop |
| 5945 | #endif | 5947 | #endif /* __clang__ */ |
| 5946 | 5948 | ||
| 5947 | 5949 | ||
| 5948 | 5950 | ||
| @@ -5991,11 +5993,11 @@ android_update_selection (struct frame *f, struct window *w) | |||
| 5991 | ? min (w->last_mark, TYPE_MAXIMUM (jint)) | 5993 | ? min (w->last_mark, TYPE_MAXIMUM (jint)) |
| 5992 | : point); | 5994 | : point); |
| 5993 | 5995 | ||
| 5994 | /* Send the update. Android doesn't have a concept of ``point'' and | 5996 | /* Send the update. Android doesn't employ a concept of ``point'' |
| 5995 | ``mark''; instead, it only has a selection, where the start of | 5997 | and ``mark''; instead, it only has a selection, where the start |
| 5996 | the selection is less than or equal to the end. Also, convert | 5998 | of the selection is less than or equal to the end, and the region |
| 5997 | the indices from 1-based Emacs indices to 0-based Android | 5999 | is ``active'' when those two values differ. Also, convert the |
| 5998 | ones. */ | 6000 | indices from 1-based Emacs indices to 0-based Android ones. */ |
| 5999 | android_update_ic (FRAME_ANDROID_WINDOW (f), min (point, mark) - 1, | 6001 | android_update_ic (FRAME_ANDROID_WINDOW (f), min (point, mark) - 1, |
| 6000 | max (point, mark) - 1, start, end); | 6002 | max (point, mark) - 1, start, end); |
| 6001 | 6003 | ||
| @@ -6066,9 +6068,10 @@ android_reset_conversion (struct frame *f) | |||
| 6066 | 6068 | ||
| 6067 | /* Reset the input method. | 6069 | /* Reset the input method. |
| 6068 | 6070 | ||
| 6069 | Pick an appropriate ``input mode'' based on whether or not the | 6071 | Select an appropriate ``input mode'' based on whether or not the |
| 6070 | minibuffer window is selected; this controls whether or not | 6072 | minibuffer window is selected, which in turn affects if ``RET'' |
| 6071 | ``RET'' inserts a newline or sends an actual key event. */ | 6073 | inserts a newline or sends an editor action Emacs transforms into |
| 6074 | a key event (refer to `performEditorAction'.) */ | ||
| 6072 | 6075 | ||
| 6073 | w = XWINDOW (f->selected_window); | 6076 | w = XWINDOW (f->selected_window); |
| 6074 | buffer = XBUFFER (WINDOW_BUFFER (w)); | 6077 | buffer = XBUFFER (WINDOW_BUFFER (w)); |
| @@ -6360,7 +6363,7 @@ android_set_build_fingerprint (void) | |||
| 6360 | { | 6363 | { |
| 6361 | #ifdef ANDROID_STUBIFY | 6364 | #ifdef ANDROID_STUBIFY |
| 6362 | Vandroid_build_fingerprint = Qnil; | 6365 | Vandroid_build_fingerprint = Qnil; |
| 6363 | #else | 6366 | #else /* !ANDROID_STUBIFY */ |
| 6364 | jclass class; | 6367 | jclass class; |
| 6365 | jfieldID field; | 6368 | jfieldID field; |
| 6366 | jobject string; | 6369 | jobject string; |
| @@ -6378,7 +6381,7 @@ android_set_build_fingerprint (void) | |||
| 6378 | else | 6381 | else |
| 6379 | { | 6382 | { |
| 6380 | /* Obtain Build.FINGERPRINT. Clear exceptions after each query; | 6383 | /* Obtain Build.FINGERPRINT. Clear exceptions after each query; |
| 6381 | JNI can't find Build.FINGERPRIN on some systems. */ | 6384 | JNI can't find Build.FINGERPRINT on some systems. */ |
| 6382 | 6385 | ||
| 6383 | class = (*android_java_env)->FindClass (android_java_env, | 6386 | class = (*android_java_env)->FindClass (android_java_env, |
| 6384 | "android/os/Build"); | 6387 | "android/os/Build"); |
| @@ -6415,7 +6418,7 @@ android_set_build_fingerprint (void) | |||
| 6415 | (*android_java_env)->ReleaseStringUTFChars (android_java_env, | 6418 | (*android_java_env)->ReleaseStringUTFChars (android_java_env, |
| 6416 | string, data); | 6419 | string, data); |
| 6417 | 6420 | ||
| 6418 | /* Now obtain Build.MANUFACTURER. */ | 6421 | /* Now retrieve Build.MANUFACTURER. */ |
| 6419 | 6422 | ||
| 6420 | ANDROID_DELETE_LOCAL_REF (string); | 6423 | ANDROID_DELETE_LOCAL_REF (string); |
| 6421 | string = NULL; | 6424 | string = NULL; |
| @@ -6462,7 +6465,7 @@ android_set_build_fingerprint (void) | |||
| 6462 | 6465 | ||
| 6463 | Vandroid_build_fingerprint = Qnil; | 6466 | Vandroid_build_fingerprint = Qnil; |
| 6464 | Vandroid_build_manufacturer = Qnil; | 6467 | Vandroid_build_manufacturer = Qnil; |
| 6465 | #endif | 6468 | #endif /* ANDROID_STUBIFY */ |
| 6466 | } | 6469 | } |
| 6467 | 6470 | ||
| 6468 | void | 6471 | void |