used to make Android run stuff. */
if (!event->xaction.window && !event->xaction.action)
- {
- /* Check for and run anything the UI thread wants to run on the main
- thread. */
- android_check_query ();
- goto OTHER;
- }
+ /* Don't run queries here, as it may run inside editor
+ commands, which can expose an inconsistent view of buffer
+ contents to the input method during command execution.
+
+ Instead, wait for Emacs to return to `android_select'. */
+ goto OTHER;
f = any;
\f
+/* Define debugging macros. */
+
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+#if 0
+#include <android/log.h>
+
+#define TEXTCONV_DEBUG(fmt, ...) \
+ __android_log_print (ANDROID_LOG_VERBOSE, "EmacsInputConnection", \
+ "%s: " fmt, __func__, ## __VA_ARGS__)
+#endif /* 0 */
+#endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */
+
+#ifndef TEXTCONV_DEBUG
+#define TEXTCONV_DEBUG(...) ((void) 0)
+#endif /* TEXTCONV_DEBUG */
+
+\f
+
/* The window system's text conversion interface. NULL when the
window system has not set up text conversion. */
/* This should deactivate the mark. */
call0 (Qdeactivate_mark);
+ /* Print some debugging information. */
+ TEXTCONV_DEBUG ("text inserted: %s, point now: %zd",
+ SSDATA (text), PT);
+
/* Update the ephemeral last point. */
w = XWINDOW (selected_window);
w->ephemeral_last_point = PT;
if (!NILP (f->conversion.compose_region_overlay))
Fdelete_overlay (f->conversion.compose_region_overlay);
+
+ TEXTCONV_DEBUG ("conversion region removed");
}
/* Set the composing text on F to TEXT. Then, move point to an
w = XWINDOW (selected_window);
w->ephemeral_last_point = PT;
+ if (SCHARS (text))
+ TEXTCONV_DEBUG ("conversion region set to: %td %td",
+ marker_position (f->conversion.compose_region_start),
+ marker_position (f->conversion.compose_region_end));
+ else
+ TEXTCONV_DEBUG ("conversion region removed; PT is now: %td", PT);
+
unbind_to (count, Qnil);
}
make_fixnum (end), Qnil);
sync_overlay (f);
+ TEXTCONV_DEBUG ("composing region set to: %td, %td; point is: %td",
+ start, end, PT);
+
/* Update the ephemeral last point. */
w = XWINDOW (selected_window);
w->ephemeral_last_point = PT;
record_buffer_change (start, start, text);
}
+ TEXTCONV_DEBUG ("deleted surrounding text: %td, %td; PT is now %td",
+ left, right, PT);
+
/* if the mark is now equal to start, deactivate it. */
if (get_mark () == PT)
w = XWINDOW (selected_window);
w->ephemeral_last_point = PT;
+ TEXTCONV_DEBUG ("set point and mark: %td %td",
+ PT, get_mark ());
+
unbind_to (count, Qnil);
}
*length = end - start;
*bytes = end_byte - start_byte;
+ TEXTCONV_DEBUG ("get_extracted_text: PT, mark, start: %td, %td, %td",
+ PT, mark, start);
+
finish:
unbind_to (count, Qnil);
return buffer;