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-^").
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean hideStatusIcon() {
|
||||
return true;
|
||||
public boolean performEditorAction(int actionCode) {
|
||||
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) {
|
||||
@@ -2720,13 +2715,12 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
||||
}
|
||||
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
switch(event.getKeyCode()) {
|
||||
case KeyEvent.KEYCODE_ENTER:
|
||||
sendChar('\r');
|
||||
break;
|
||||
case KeyEvent.KEYCODE_DEL:
|
||||
sendChar(127);
|
||||
break;
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
switch(event.getKeyCode()) {
|
||||
case KeyEvent.KEYCODE_DEL:
|
||||
sendChar(127);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -2739,10 +2733,6 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean showStatusIcon(String packageName, int resId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendChar(int c) {
|
||||
try {
|
||||
mTermOut.write(c);
|
||||
|
||||
Reference in New Issue
Block a user