derivatives of @code{text-mode} and @code{prog-mode}.
Text conversion is performed asynchronously whenever Emacs receives
-a request to perform the conversion from the input method. After the
-conversion completes, a @code{text-conversion} event is sent.
-@xref{Misc Events,,, elisp, the Emacs Reference Manual}.
+a request to perform the conversion from the input method, and Emacs
+is not currently reading a key sequence for which one prefix key has
+already been read (@pxref{Keys}.) After the conversion completes, a
+@code{text-conversion} event is sent. @xref{Misc Events,,, elisp, the
+Emacs Reference Manual}.
@vindex text-conversion-face
If the input method needs to work on a region of the buffer, then
public ExtractedText
getExtractedText (ExtractedTextRequest request, int flags)
{
+ ExtractedText text;
+
if (EmacsService.DEBUG_IC)
Log.d (TAG, "getExtractedText: " + request + " " + flags);
- return EmacsNative.getExtractedText (windowHandle, request,
+ text = EmacsNative.getExtractedText (windowHandle, request,
flags);
+
+ if (EmacsService.DEBUG_IC)
+ Log.d (TAG, "getExtractedText: " + text.text + " @"
+ + text.startOffset + ":" + text.selectionStart);
+
+ return text;
}
@Override
return true;
}
+ @Override
+ public boolean
+ sendKeyEvent (KeyEvent key)
+ {
+ if (EmacsService.DEBUG_IC)
+ Log.d (TAG, "sendKeyEvent: " + key);
+
+ return super.sendKeyEvent (key);
+ }
+
\f
/* Override functions which are not implemented. */
/* Gets around Microsoft compiler limitations. */
bool dummyflag = false;
+#ifdef HAVE_TEXT_CONVERSION
+ bool disabled_conversion;
+
+ /* Whether or not text conversion has already been disabled. */
+ disabled_conversion = false;
+#endif
+
struct buffer *starting_buffer;
/* List of events for which a fake prefix key has been generated. */
echo_local_start = echo_length ();
keys_local_start = this_command_key_count;
+#ifdef HAVE_TEXT_CONVERSION
+ /* When reading a key sequence while text conversion is in
+ effect, turn it off after the first character read. This
+ makes input methods send actual key events instead.
+
+ Make sure only to do this once. */
+
+ if (!disabled_conversion && t)
+ {
+ disable_text_conversion ();
+ record_unwind_protect_void (resume_text_conversion);
+
+ disabled_conversion = true;
+ }
+#endif
+
replay_key:
/* These are no-ops, unless we throw away a keystroke below and
jumped back up to replay_key; in that case, these restore the
/* Figure out the bounds of the text to return. */
if (n != -1)
{
+ /* Make sure n is at least 2. */
+ n = max (2, n);
+
start = PT - n / 2;
end = PT + n - n / 2;
}