I'm running Linux in single user text mode (as described here). Ctrl+PgUp
and Ctrl+PgDn
don't behave as expected. Using cat -v -
to show the terminal codes, I see that PgUp
and Ctrl+PgUp
both produce the same code ^[[5~
. Doing the same thing in graphical mode I see PgUp
=> ^[[5~
and Ctrl+PgUp
=> ^[[5;5~
(and both keys work as expected). Therefore I conjecture:
- It's not a hardware problem
- The mapping
PgUp
=>^[[5~
is working as intended - The problem is that
Ctrl+PgUp
looks likePgUp
once it reaches the terminal.
For my use case (Vim) I can configure PgUp
to be treated as Ctrl+PgUp
, but if possible I'd like them to have different behaviours.
Is there some configuration I can edit to fix this? Does anything modify the character sequences before they reach the terminal?
More notes from further investigation:
- Rather than booting to text mode, I can reproduce this just by dropping to tty1 (
Ctrl+Alt+F1
). - I can reproduce it on a different machine.
- Following dirkt's suggestion I ran
echo $TERM
and gotlinux
.
linux
(echo $TERM
), andinfocmp linux
shows thatknp
(next page) andkpp
(previous page) are bound toESC [ 6 ~
andESC [ 5 ~
, respectively. So this is a "feature" of the linux text console, though I am not sure exactly which level is responsible, and how to configure it. Maybe trying to configure vim to recognize the escape sequences is simpler.infocmp
. However I think the problem is not whatPgUp
maps to, but thatPgUp
andCtrl+PgUp
are indistinguishable. I'll make an edit to clarify.knp
andkpp
. You can easily check the lowest layers withevtest
, and my guess is that theCtrl
key will be clearly visible, and the translation happens after the keyboard events leave the kernel input layer and enter the console line discipline (or whereever that translation actually sits).