Support Swype IME backspace key.
Thanks to Julian Brost (who fixed the same bug in the connectbot project), and thanks to Todd Musall for spotting the bug fix in the connectbot tracker, and tried it out in Android Term. In general we now support any IME trying to delete text to the left of the cursor by calling InputConnector.deleteSurroundingText(). We generate one "del" key event for each character of text that is to be deleted. We don't support deleting text to the right of the cursor. If this becomes an issue we can experiment with forward-cursor followed by del.
This commit is contained in:
parent
f45c3a228c
commit
d4122bbc6a
@ -1,6 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="jackpal.androidterm"
|
||||
android:versionName="1.0.14" android:versionCode="15">
|
||||
android:versionName="1.0.15" android:versionCode="16">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<application android:icon="@drawable/app_terminal"
|
||||
|
@ -2809,6 +2809,16 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSurroundingText(int leftLength, int rightLength) {
|
||||
for (int i = 0; i < leftLength; i++) {
|
||||
sendKeyEvent(
|
||||
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
|
||||
}
|
||||
// TODO: handle forward deletes.
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendChar(int c) {
|
||||
try {
|
||||
mapAndSend(c);
|
||||
|
Loading…
Reference in New Issue
Block a user