aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/androidterm.c')
-rw-r--r--src/androidterm.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/androidterm.c b/src/androidterm.c
index 6f7c06875ca..a9b5834c08f 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -5196,7 +5196,7 @@ struct android_get_extracted_text_context
5196 ptrdiff_t length, bytes; 5196 ptrdiff_t length, bytes;
5197 5197
5198 /* Offsets into that text. */ 5198 /* Offsets into that text. */
5199 ptrdiff_t start, offset; 5199 ptrdiff_t start, start_offset, end_offset;
5200 5200
5201 /* The window. */ 5201 /* The window. */
5202 android_window window; 5202 android_window window;
@@ -5222,8 +5222,9 @@ android_get_extracted_text (void *data)
5222 /* Now get the extracted text. */ 5222 /* Now get the extracted text. */
5223 request->text 5223 request->text
5224 = get_extracted_text (f, min (request->hint_max_chars, 600), 5224 = get_extracted_text (f, min (request->hint_max_chars, 600),
5225 &request->start, &request->offset, 5225 &request->start, &request->start_offset,
5226 &request->length, &request->bytes); 5226 &request->end_offset, &request->length,
5227 &request->bytes);
5227 5228
5228 /* See if request->flags & GET_EXTRACTED_TEXT_MONITOR. If so, then 5229 /* See if request->flags & GET_EXTRACTED_TEXT_MONITOR. If so, then
5229 the input method has asked to monitor changes to the extracted 5230 the input method has asked to monitor changes to the extracted
@@ -5268,8 +5269,9 @@ struct android_extracted_text_class text_class;
5268 5269
5269/* Return an ExtractedText object corresponding to the extracted text 5270/* Return an ExtractedText object corresponding to the extracted text
5270 TEXT. START is a character position describing the offset of the 5271 TEXT. START is a character position describing the offset of the
5271 first character in TEXT. OFFSET is the offset of point relative to 5272 first character in TEXT. START_OFFSET is the offset of the lesser
5272 START. 5273 of point or mark relative to START, and END_OFFSET is that of the
5274 greater of point or mark relative to START.
5273 5275
5274 Assume that request_class and text_class have already been 5276 Assume that request_class and text_class have already been
5275 initialized. 5277 initialized.
@@ -5279,7 +5281,8 @@ struct android_extracted_text_class text_class;
5279 5281
5280static jobject 5282static jobject
5281android_build_extracted_text (jstring text, ptrdiff_t start, 5283android_build_extracted_text (jstring text, ptrdiff_t start,
5282 ptrdiff_t offset) 5284 ptrdiff_t start_offset,
5285 ptrdiff_t end_offset)
5283{ 5286{
5284 JNIEnv *env; 5287 JNIEnv *env;
5285 jobject object; 5288 jobject object;
@@ -5299,9 +5302,9 @@ android_build_extracted_text (jstring text, ptrdiff_t start,
5299 (*env)->SetIntField (env, object, text_class.partial_start_offset, -1); 5302 (*env)->SetIntField (env, object, text_class.partial_start_offset, -1);
5300 (*env)->SetIntField (env, object, text_class.partial_end_offset, -1); 5303 (*env)->SetIntField (env, object, text_class.partial_end_offset, -1);
5301 (*env)->SetIntField (env, object, text_class.selection_start, 5304 (*env)->SetIntField (env, object, text_class.selection_start,
5302 min (offset, TYPE_MAXIMUM (jint))); 5305 min (start_offset, TYPE_MAXIMUM (jint)));
5303 (*env)->SetIntField (env, object, text_class.selection_end, 5306 (*env)->SetIntField (env, object, text_class.selection_end,
5304 min (offset, TYPE_MAXIMUM (jint))); 5307 min (end_offset, TYPE_MAXIMUM (jint)));
5305 5308
5306 /* Subtract 1 from start: point indices in Emacs start from 1, but 5309 /* Subtract 1 from start: point indices in Emacs start from 1, but
5307 Android expects 0. */ 5310 Android expects 0. */
@@ -5404,9 +5407,9 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
5404 (*env)->SetIntField (env, object, text_class.partial_start_offset, -1); 5407 (*env)->SetIntField (env, object, text_class.partial_start_offset, -1);
5405 (*env)->SetIntField (env, object, text_class.partial_end_offset, -1); 5408 (*env)->SetIntField (env, object, text_class.partial_end_offset, -1);
5406 (*env)->SetIntField (env, object, text_class.selection_start, 5409 (*env)->SetIntField (env, object, text_class.selection_start,
5407 min (context.offset, TYPE_MAXIMUM (jint))); 5410 min (context.start_offset, TYPE_MAXIMUM (jint)));
5408 (*env)->SetIntField (env, object, text_class.selection_end, 5411 (*env)->SetIntField (env, object, text_class.selection_end,
5409 min (context.offset, TYPE_MAXIMUM (jint))); 5412 min (context.end_offset, TYPE_MAXIMUM (jint)));
5410 5413
5411 /* Subtract 1 from start: point indices in Emacs start from 1, but 5414 /* Subtract 1 from start: point indices in Emacs start from 1, but
5412 Android expects 0. */ 5415 Android expects 0. */
@@ -5507,7 +5510,8 @@ NATIVE_NAME (requestCursorUpdates) (JNIEnv *env, jobject object,
5507static void 5510static void
5508android_update_selection (struct frame *f, struct window *w) 5511android_update_selection (struct frame *f, struct window *w)
5509{ 5512{
5510 ptrdiff_t start, end, point, mark, offset, length, bytes; 5513 ptrdiff_t start, end, point, mark, start_offset, end_offset;
5514 ptrdiff_t length, bytes;
5511 struct buffer *b; 5515 struct buffer *b;
5512 int hint, token; 5516 int hint, token;
5513 char *text; 5517 char *text;
@@ -5560,7 +5564,8 @@ android_update_selection (struct frame *f, struct window *w)
5560 hint = FRAME_ANDROID_OUTPUT (f)->extracted_text_hint; 5564 hint = FRAME_ANDROID_OUTPUT (f)->extracted_text_hint;
5561 token = FRAME_ANDROID_OUTPUT (f)->extracted_text_token; 5565 token = FRAME_ANDROID_OUTPUT (f)->extracted_text_token;
5562 text = get_extracted_text (f, min (hint, 600), &start, 5566 text = get_extracted_text (f, min (hint, 600), &start,
5563 &offset, &length, &bytes); 5567 &start_offset, &end_offset,
5568 &length, &bytes);
5564 5569
5565 if (text) 5570 if (text)
5566 { 5571 {
@@ -5572,7 +5577,8 @@ android_update_selection (struct frame *f, struct window *w)
5572 5577
5573 /* Make extracted text out of that string. */ 5578 /* Make extracted text out of that string. */
5574 extracted = android_build_extracted_text (string, start, 5579 extracted = android_build_extracted_text (string, start,
5575 offset); 5580 start_offset,
5581 end_offset);
5576 android_exception_check_1 (string); 5582 android_exception_check_1 (string);
5577 ANDROID_DELETE_LOCAL_REF (string); 5583 ANDROID_DELETE_LOCAL_REF (string);
5578 5584