Add F1-F12 and Ins/Del/Home/End keys
Contributed by Steven Luo steven+android@steven676.net who writes: The mapping is as follows: Fn-[1-9]: F1-F9 Fn-0: F10 Ctrl-9: F11 Ctrl-0: F12 Fn-I: Ins Fn-X: Del Fn-H: Home Fn-F: End It should be noted that a real VT100 does not have Home/End keys, and as such, the terminfo entry for TERM=vt100 doesn't contain escape codes for Home and End. This bothers some applications, but not others. The codes generated match those sent by the Linux console (TERM=linux), which appears to work fine as a TERM setting since the emulation fixes in 1.0.30. xterm sends different escape codes, though; I left the escape codes at their present values because TERM=xterm causes problems with some applications. Addresses GitHub issue #9. --- I'm unhappy with the reintroduction of different behaviors for the Ctrl key, but I couldn't think of another choice that's guaranteed to make sense on any soft keyboard layout. (Fn-J/K and Fn-(/) are the two other possibilities that occurred to me.) Feel free to change.
This commit is contained in:
parent
29e95e964e
commit
cb368f0f48
@ -4440,6 +4440,10 @@ class TermKeyListener {
|
||||
result = 31;
|
||||
} else if (result == '8') {
|
||||
result = 127; // DEL
|
||||
} else if (result == '9') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_F11;
|
||||
} else if (result == '0') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_F12;
|
||||
}
|
||||
} else if (mFnKey.isActive()) {
|
||||
if (result == 'w' || result == 'W') {
|
||||
@ -4464,6 +4468,19 @@ class TermKeyListener {
|
||||
result = 27; // ^[ (Esc)
|
||||
} else if (result == '.') {
|
||||
result = 28; // ^\
|
||||
} else if (result > '0' && result <= '9') {
|
||||
// F1-F9
|
||||
result = (char)(result + KEYCODE_OFFSET + TermKeyListener.KEYCODE_F1 - 1);
|
||||
} else if (result == '0') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_F10;
|
||||
} else if (result == 'i' || result == 'I') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_INSERT;
|
||||
} else if (result == 'x' || result == 'X') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_FORWARD_DEL;
|
||||
} else if (result == 'h' || result == 'H') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_MOVE_HOME;
|
||||
} else if (result == 'f' || result == 'F') {
|
||||
result = KEYCODE_OFFSET + TermKeyListener.KEYCODE_MOVE_END;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user