mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-17 01:10:10 +00:00
Update Android port
* doc/emacs/input.texi (On-Screen Keyboards): * doc/lispref/commands.texi (Misc Events): Improve documentation of text conversion stuff. * java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit) (endBatchEdit, commitCompletion, commitText, deleteSurroundingText) (finishComposingText, getSelectedText, getTextAfterCursor) (EmacsInputConnection, setComposingRegion, performEditorAction) (getExtractedText): Condition debug code on DEBUG_IC. * java/org/gnu/emacs/EmacsService.java (EmacsService, updateIC): Likewise. * lisp/bindings.el (global-map): * lisp/electric.el (global-map): Make `text-conversion' `analyze-text-conversion'. * lisp/progmodes/prog-mode.el (prog-mode): Enable text conversion in input methods. * lisp/simple.el (analyze-text-conversion): New function. * lisp/textmodes/text-mode.el (text-conversion-style) (text-mode): Likewise. * src/androidterm.c (android_handle_ime_event): Handle set_point_and_mark. (android_sync_edit): Give Emacs 100 ms instead. (android_perform_conversion_query): Skip the active region, not the conversion region. (getSelectedText): Implement properly. (android_update_selection): Expose mark to input methods. (android_reset_conversion): Handle `text-conversion-style'. * src/buffer.c (init_buffer_once, syms_of_buffer): Add buffer local variable `text-conversion-style'. * src/buffer.h (struct buffer, bset_text_conversion_style): New fields. * src/emacs.c (android_emacs_init): Call syms_of_textconv. * src/frame.h (enum text_conversion_operation): Rename TEXTCONV_SET_POINT. * src/lisp.h: Export syms_of_textconv. * src/marker.c (set_marker_internal): Force redisplay when the mark is set and the buffer is visible on builds that use text conversion. Explain why. * src/textconv.c (copy_buffer): Fix copying past gap. (get_mark): New function. (textconv_query): Implement new flag. (sync_overlay): New function. Display conversion text in an overlay. (record_buffer_change, really_commit_text) (really_set_composing_text, really_set_composing_region) (really_delete_surrounding_text, really_set_point) (handle_pending_conversion_events_1, decrement_inside) (handle_pending_conversion_events, textconv_set_point) (get_extracted_text, register_textconv_interface): Various fixes and improvements. * src/textconv.h (struct textconv_interface): Update documentation. * src/window.h (GCALIGNED_STRUCT): New field `prev_mark'. * src/xdisp.c (mark_window_display_accurate_1): Handle prev_mark.
This commit is contained in:
parent
dd7066901f
commit
cf24b61985
20 changed files with 607 additions and 81 deletions
|
@ -55,7 +55,9 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
beginBatchEdit ()
|
||||
{
|
||||
Log.d (TAG, "beginBatchEdit");
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "beginBatchEdit");
|
||||
|
||||
EmacsNative.beginBatchEdit (windowHandle);
|
||||
return true;
|
||||
}
|
||||
|
@ -64,7 +66,9 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
endBatchEdit ()
|
||||
{
|
||||
Log.d (TAG, "endBatchEdit");
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "endBatchEdit");
|
||||
|
||||
EmacsNative.endBatchEdit (windowHandle);
|
||||
return true;
|
||||
}
|
||||
|
@ -73,7 +77,9 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
commitCompletion (CompletionInfo info)
|
||||
{
|
||||
Log.d (TAG, "commitCompletion: " + info);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "commitCompletion: " + info);
|
||||
|
||||
EmacsNative.commitCompletion (windowHandle,
|
||||
info.getText ().toString (),
|
||||
info.getPosition ());
|
||||
|
@ -84,7 +90,9 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
commitText (CharSequence text, int newCursorPosition)
|
||||
{
|
||||
Log.d (TAG, "commitText: " + text + " " + newCursorPosition);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "commitText: " + text + " " + newCursorPosition);
|
||||
|
||||
EmacsNative.commitText (windowHandle, text.toString (),
|
||||
newCursorPosition);
|
||||
return true;
|
||||
|
@ -94,8 +102,10 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
deleteSurroundingText (int leftLength, int rightLength)
|
||||
{
|
||||
Log.d (TAG, ("deleteSurroundingText: "
|
||||
+ leftLength + " " + rightLength));
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, ("deleteSurroundingText: "
|
||||
+ leftLength + " " + rightLength));
|
||||
|
||||
EmacsNative.deleteSurroundingText (windowHandle, leftLength,
|
||||
rightLength);
|
||||
return true;
|
||||
|
@ -105,7 +115,8 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
finishComposingText ()
|
||||
{
|
||||
Log.d (TAG, "finishComposingText");
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "finishComposingText");
|
||||
|
||||
EmacsNative.finishComposingText (windowHandle);
|
||||
return true;
|
||||
|
@ -115,7 +126,8 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public String
|
||||
getSelectedText (int flags)
|
||||
{
|
||||
Log.d (TAG, "getSelectedText: " + flags);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "getSelectedText: " + flags);
|
||||
|
||||
return EmacsNative.getSelectedText (windowHandle, flags);
|
||||
}
|
||||
|
@ -124,27 +136,44 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public String
|
||||
getTextAfterCursor (int length, int flags)
|
||||
{
|
||||
Log.d (TAG, "getTextAfterCursor: " + length + " " + flags);
|
||||
String string;
|
||||
|
||||
return EmacsNative.getTextAfterCursor (windowHandle, length,
|
||||
flags);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "getTextAfterCursor: " + length + " " + flags);
|
||||
|
||||
string = EmacsNative.getTextAfterCursor (windowHandle, length,
|
||||
flags);
|
||||
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, " --> " + string);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String
|
||||
getTextBeforeCursor (int length, int flags)
|
||||
{
|
||||
Log.d (TAG, "getTextBeforeCursor: " + length + " " + flags);
|
||||
String string;
|
||||
|
||||
return EmacsNative.getTextBeforeCursor (windowHandle, length,
|
||||
flags);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "getTextBeforeCursor: " + length + " " + flags);
|
||||
|
||||
string = EmacsNative.getTextBeforeCursor (windowHandle, length,
|
||||
flags);
|
||||
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, " --> " + string);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean
|
||||
setComposingText (CharSequence text, int newCursorPosition)
|
||||
{
|
||||
Log.d (TAG, "setComposingText: " + newCursorPosition);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "setComposingText: " + newCursorPosition);
|
||||
|
||||
EmacsNative.setComposingText (windowHandle, text.toString (),
|
||||
newCursorPosition);
|
||||
|
@ -155,7 +184,8 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
setComposingRegion (int start, int end)
|
||||
{
|
||||
Log.d (TAG, "setComposingRegion: " + start + " " + end);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "setComposingRegion: " + start + " " + end);
|
||||
|
||||
EmacsNative.setComposingRegion (windowHandle, start, end);
|
||||
return true;
|
||||
|
@ -165,7 +195,8 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public boolean
|
||||
performEditorAction (int editorAction)
|
||||
{
|
||||
Log.d (TAG, "performEditorAction: " + editorAction);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "performEditorAction: " + editorAction);
|
||||
|
||||
EmacsNative.performEditorAction (windowHandle, editorAction);
|
||||
return true;
|
||||
|
@ -175,7 +206,8 @@ public class EmacsInputConnection extends BaseInputConnection
|
|||
public ExtractedText
|
||||
getExtractedText (ExtractedTextRequest request, int flags)
|
||||
{
|
||||
Log.d (TAG, "getExtractedText: " + request + " " + flags);
|
||||
if (EmacsService.DEBUG_IC)
|
||||
Log.d (TAG, "getExtractedText: " + request + " " + flags);
|
||||
|
||||
return EmacsNative.getExtractedText (windowHandle, request,
|
||||
flags);
|
||||
|
|
|
@ -88,6 +88,8 @@ public class EmacsService extends Service
|
|||
/* Display metrics used by font backends. */
|
||||
public DisplayMetrics metrics;
|
||||
|
||||
public static final boolean DEBUG_IC = false;
|
||||
|
||||
@Override
|
||||
public int
|
||||
onStartCommand (Intent intent, int flags, int startId)
|
||||
|
@ -612,10 +614,11 @@ invocation of app_process (through android-emacs) can
|
|||
int newSelectionEnd, int composingRegionStart,
|
||||
int composingRegionEnd)
|
||||
{
|
||||
Log.d (TAG, ("updateIC: " + window + " " + newSelectionStart
|
||||
+ " " + newSelectionEnd + " "
|
||||
+ composingRegionStart + " "
|
||||
+ composingRegionEnd));
|
||||
if (DEBUG_IC)
|
||||
Log.d (TAG, ("updateIC: " + window + " " + newSelectionStart
|
||||
+ " " + newSelectionEnd + " "
|
||||
+ composingRegionStart + " "
|
||||
+ composingRegionEnd));
|
||||
window.view.imManager.updateSelection (window.view,
|
||||
newSelectionStart,
|
||||
newSelectionEnd,
|
||||
|
@ -626,7 +629,8 @@ invocation of app_process (through android-emacs) can
|
|||
public void
|
||||
resetIC (EmacsWindow window, int icMode)
|
||||
{
|
||||
Log.d (TAG, "resetIC: " + window);
|
||||
if (DEBUG_IC)
|
||||
Log.d (TAG, "resetIC: " + window);
|
||||
|
||||
window.view.setICMode (icMode);
|
||||
window.view.imManager.restartInput (window.view);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue