mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-11 22:11:21 -08:00
Avoid responding to input method queries asynchronously
* src/androidterm.c (handle_one_android_event): Don't answer queries here; just rely on the event interrupting android_select. This avoids exposing buffer contents to input methods while a command is being executed. * src/textconv.c (TEXTCONV_DEBUG, really_commit_text) (really_finish_composing_text, really_set_composing_text) (really_set_composing_region, really_delete_surrounding_text) (really_set_point_and_mark, get_extracted_text): Add debugging printouts.
This commit is contained in:
parent
a5b74e2ff6
commit
01bea42cbf
2 changed files with 49 additions and 6 deletions
|
|
@ -1053,12 +1053,12 @@ handle_one_android_event (struct android_display_info *dpyinfo,
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,24 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|||
|
||||
|
||||
|
||||
/* 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 */
|
||||
|
||||
|
||||
|
||||
/* The window system's text conversion interface. NULL when the
|
||||
window system has not set up text conversion. */
|
||||
|
||||
|
|
@ -701,6 +719,10 @@ really_commit_text (struct frame *f, EMACS_INT position,
|
|||
/* 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;
|
||||
|
|
@ -730,6 +752,8 @@ really_finish_composing_text (struct frame *f, bool update)
|
|||
|
||||
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
|
||||
|
|
@ -876,6 +900,13 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
@ -927,6 +958,9 @@ really_set_composing_region (struct frame *f, ptrdiff_t start,
|
|||
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;
|
||||
|
|
@ -1011,6 +1045,9 @@ really_delete_surrounding_text (struct frame *f, ptrdiff_t left,
|
|||
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)
|
||||
|
|
@ -1093,6 +1130,9 @@ really_set_point_and_mark (struct frame *f, ptrdiff_t point,
|
|||
w = XWINDOW (selected_window);
|
||||
w->ephemeral_last_point = PT;
|
||||
|
||||
TEXTCONV_DEBUG ("set point and mark: %td %td",
|
||||
PT, get_mark ());
|
||||
|
||||
unbind_to (count, Qnil);
|
||||
}
|
||||
|
||||
|
|
@ -1727,6 +1767,9 @@ get_extracted_text (struct frame *f, ptrdiff_t n,
|
|||
*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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue