[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android fa1b27930ea: Notify input methods when editing fails
From: |
Po Lu |
Subject: |
feature/android fa1b27930ea: Notify input methods when editing fails |
Date: |
Sat, 18 Feb 2023 01:48:26 -0500 (EST) |
branch: feature/android
commit fa1b27930ea5f61d92880c3c252774f2f97f529d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Notify input methods when editing fails
* INSTALL.android: Clarify build instructions.
* src/textconv.c (struct complete_edit_check_context): New
structure.
(complete_edit_check): New function.
(handle_pending_conversion_events_1): If the window is known,
then ensure that any editing failures are reported to the input
method.
---
INSTALL.android | 9 ++++++---
src/textconv.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/INSTALL.android b/INSTALL.android
index ab39a55eaf3..442bfef6422 100644
--- a/INSTALL.android
+++ b/INSTALL.android
@@ -555,8 +555,9 @@ libtasn1, p11-kit) which can be built with the ndk-build
system can be
found at https://sourceforge.net/projects/android-ports-for-gnu-emacs.
They have only been tested on arm64 Android systems running Android
-5.0 or later, so your mileage may vary, especially if you are trying
-to build Emacs for another kind of machine.
+5.0 or later, and armv7l systems running Android 13 or later, so your
+mileage may vary, especially if you are trying to build Emacs for
+another kind of machine.
To build Emacs with GnuTLS, you must unpack each of the following tar
archives in that site:
@@ -567,7 +568,9 @@ archives in that site:
p11-kit-0.24.1-emacs.tar.gz
nettle-3.8-emacs.tar.gz
-and add the resulting folders to ``--with-ndk-path''.
+and add the resulting folders to ``--with-ndk-path''. Note that you
+should not try to build these packages separately using any
+`configure' script or Makefiles inside.
diff --git a/src/textconv.c b/src/textconv.c
index 7704f1b62a6..50146820dce 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -978,6 +978,52 @@ complete_edit (void *token)
text_interface->notify_conversion (*(unsigned long *) token);
}
+/* Context for complete_edit_check. */
+
+struct complete_edit_check_context
+{
+ /* The window. */
+ struct window *w;
+
+ /* Whether or not editing was successful. */
+ bool check;
+};
+
+/* If CONTEXT->check is false, then update W's ephemeral last point
+ and give it to the input method, the assumption being that an
+ editing operation signalled. */
+
+static void
+complete_edit_check (void *ptr)
+{
+ struct complete_edit_check_context *context;
+ struct frame *f;
+
+ context = ptr;
+
+ if (!context->check)
+ {
+ /* Figure out the new position of point. */
+ context->w->ephemeral_last_point
+ = window_point (context->w);
+
+ /* See if the frame is still alive. */
+
+ f = WINDOW_XFRAME (context->w);
+
+ if (!FRAME_LIVE_P (f))
+ return;
+
+ if (text_interface && text_interface->point_changed)
+ {
+ if (f->conversion.batch_edit_count > 0)
+ f->conversion.batch_edit_flags |= PENDING_POINT_CHANGE;
+ else
+ text_interface->point_changed (f, context->w, NULL);
+ }
+ }
+}
+
/* Process and free the text conversion ACTION. F must be the frame
on which ACTION will be performed.
@@ -993,6 +1039,7 @@ handle_pending_conversion_events_1 (struct frame *f,
struct window *w;
specpdl_ref count;
unsigned long token;
+ struct complete_edit_check_context context;
/* Next, process this action and free it. */
@@ -1008,6 +1055,10 @@ handle_pending_conversion_events_1 (struct frame *f,
if (conversion_disabled_p ())
return NULL;
+ /* check is a flag used by complete_edit_check to determine whether
+ or not the editing operation completed successfully. */
+ context.check = false;
+
/* Make sure completion is signalled. */
count = SPECPDL_INDEX ();
record_unwind_protect_ptr (complete_edit, &token);
@@ -1017,6 +1068,10 @@ handle_pending_conversion_events_1 (struct frame *f,
{
w = XWINDOW (f->old_selected_window);
buffer = XBUFFER (WINDOW_BUFFER (w));
+ context.w = w;
+
+ /* Notify the input method of any editing failures. */
+ record_unwind_protect_ptr (complete_edit_check, &context);
}
switch (operation)
@@ -1070,6 +1125,8 @@ handle_pending_conversion_events_1 (struct frame *f,
break;
}
+ /* Signal success. */
+ context.check = true;
unbind_to (count, Qnil);
return w;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/android fa1b27930ea: Notify input methods when editing fails,
Po Lu <=