AI 143272: am: CL 143256 Make the Term emulator work with the most recent keyboard IME.
+ Makes the "Enter" key work again. + Makes the "Delete" key delete just one character each time you press it instead of two. Original author: jackpal Merged from: //branches/cupcake/... Automated import of CL 143272
This commit is contained in:
committed by
The Android Open Source Project
parent
5303d5c523
commit
376013596d
@@ -548,16 +548,6 @@ public class Term extends Activity {
|
|||||||
+ controlKey + " 6 ==> Control-^").
|
+ controlKey + " 6 ==> Control-^").
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void print(String msg) {
|
|
||||||
char[] chars = msg.toCharArray();
|
|
||||||
int len = chars.length;
|
|
||||||
byte[] bytes = new byte[len];
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
bytes[i] = (byte) chars[i];
|
|
||||||
}
|
|
||||||
mEmulatorView.append(bytes, 0, len);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2707,8 +2697,13 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hideStatusIcon() {
|
public boolean performEditorAction(int actionCode) {
|
||||||
return true;
|
if(actionCode == EditorInfo.IME_ACTION_UNSPECIFIED) {
|
||||||
|
// The "return" key has been pressed on the IME.
|
||||||
|
sendText("\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean performContextMenuAction(int id) {
|
public boolean performContextMenuAction(int id) {
|
||||||
@@ -2720,13 +2715,12 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean sendKeyEvent(KeyEvent event) {
|
public boolean sendKeyEvent(KeyEvent event) {
|
||||||
switch(event.getKeyCode()) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
case KeyEvent.KEYCODE_ENTER:
|
switch(event.getKeyCode()) {
|
||||||
sendChar('\r');
|
case KeyEvent.KEYCODE_DEL:
|
||||||
break;
|
sendChar(127);
|
||||||
case KeyEvent.KEYCODE_DEL:
|
break;
|
||||||
sendChar(127);
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2739,10 +2733,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showStatusIcon(String packageName, int resId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendChar(int c) {
|
private void sendChar(int c) {
|
||||||
try {
|
try {
|
||||||
mTermOut.write(c);
|
mTermOut.write(c);
|
||||||
|
|||||||
Reference in New Issue
Block a user