Skip to content

Commit

Permalink
Commit the text on finishComposingText()
Browse files Browse the repository at this point in the history
This handles e.g. text written with hand writing input methods
as mentioned in termux#91.
  • Loading branch information
fornwall authored and frikke committed Aug 20, 2023
1 parent 3c6f093 commit ec8a20c
Showing 1 changed file with 6 additions and 31 deletions.
37 changes: 6 additions & 31 deletions app/src/main/java/com/termux/view/TerminalView.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,43 +258,18 @@ public boolean beginBatchEdit() {
return true;
}

@Override
public boolean clearMetaKeyStates(int states) {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "IME: clearMetaKeyStates(" + states + ")");
return true;
}

@Override
public boolean endBatchEdit() {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "IME: endBatchEdit()");
return false;
}

@Override
public boolean finishComposingText() {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "IME: finishComposingText()");
return true;
}

@Override
public int getCursorCapsMode(int reqModes) {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "IME: getCursorCapsMode(" + reqModes + ")");
int mode = 0;
if ((reqModes & TextUtils.CAP_MODE_CHARACTERS) != 0) {
mode |= TextUtils.CAP_MODE_CHARACTERS;
}
return mode;
}

@Override
public CharSequence getTextAfterCursor(int n, int flags) {
return "";
}

@Override
public CharSequence getTextBeforeCursor(int n, int flags) {
return "";
}
@Override
public boolean finishComposingText() {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "IME: finishComposingText()");
commitText(getEditable(), 0);
return true;
}

@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
Expand Down

0 comments on commit ec8a20c

Please sign in to comment.