|
10 | 10 | import android.os.Build; |
11 | 11 | import android.os.Handler; |
12 | 12 | import android.os.Looper; |
| 13 | +import android.os.SystemClock; |
13 | 14 | import android.text.Editable; |
14 | 15 | import android.text.InputType; |
15 | 16 | import android.text.TextUtils; |
@@ -839,13 +840,36 @@ public boolean handleKeyCode(int keyCode, int keyMod) { |
839 | 840 | if (mEmulator != null) |
840 | 841 | mEmulator.setCursorBlinkState(true); |
841 | 842 |
|
| 843 | + if (handleKeyCodeAction(keyCode, keyMod)) |
| 844 | + return true; |
| 845 | + |
842 | 846 | TerminalEmulator term = mTermSession.getEmulator(); |
843 | 847 | String code = KeyHandler.getCode(keyCode, keyMod, term.isCursorKeysApplicationMode(), term.isKeypadApplicationMode()); |
844 | 848 | if (code == null) return false; |
845 | 849 | mTermSession.write(code); |
846 | 850 | return true; |
847 | 851 | } |
848 | 852 |
|
| 853 | + public boolean handleKeyCodeAction(int keyCode, int keyMod) { |
| 854 | + boolean shiftDown = (keyMod & KeyHandler.KEYMOD_SHIFT) != 0; |
| 855 | + |
| 856 | + switch (keyCode) { |
| 857 | + case KeyEvent.KEYCODE_PAGE_UP: |
| 858 | + case KeyEvent.KEYCODE_PAGE_DOWN: |
| 859 | + // shift+page_up and shift+page_down should scroll scrollback history instead of |
| 860 | + // scrolling command history or changing pages |
| 861 | + if (shiftDown) { |
| 862 | + long time = SystemClock.uptimeMillis(); |
| 863 | + MotionEvent motionEvent = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); |
| 864 | + doScroll(motionEvent, keyCode == KeyEvent.KEYCODE_PAGE_UP ? -1 : 1); |
| 865 | + motionEvent.recycle(); |
| 866 | + return true; |
| 867 | + } |
| 868 | + } |
| 869 | + |
| 870 | + return false; |
| 871 | + } |
| 872 | + |
849 | 873 | /** |
850 | 874 | * Called when a key is released in the view. |
851 | 875 | * |
|
0 commit comments