问题
I'm implementing a vt100 terminal emulator in javascript and the vt100 spec (from man terminfo
and infocmp
) tells me that smkx=\E[?1h\E=
is the code to enter key-board transmit mode and rmkx=\E[?1l\E>
is the code to leave 'key-board transmit' mode. I couldn't really understand what key-board transmit mode is.
From http://vt100.net/dec/ek-vt220-tm-001.pdf,
7.4.4.1 Keyboard Transmit Mode -- The keyboard codes and a few other special codes are transmitted via a serial line output in PORT of the 8051. The transmitted signal goes from the 8051 to a driver, through the keyboard cable, monitor and video cable to the CPU. A UART within the 8051 controls the transmission"
I'm getting these codes while entering into and leaving vim
, respectively. Can I safely ignore these codes or do I need to handle them? In the latter case, what am I supposed to do?
回答1:
These two strings contain two sequences each; they control subtly different things:
The first of these,
CSI ? 1h
CSI ? 1l
controls DEC private mode number 1, DECCKM
, cursor key mode. This mode determines whether the four arrow keys (Up, Down, Left, Right) will send SS3 or CSI-prefixed sequences.
The second pair of sequences,
ESC =
ESC >
are called DECKPAM
, keypad application mode, and DECKPNM
, keypad numeric mode. This determines whether the number keypad sends control sequences, or normal numbers (i.e. consider it similar to the Numlock feature).
回答2:
smkx/rmkx control whether the keypad will transmit numbers or escape code. Also, it is "keypad-transmit-mode" not "keyboard-transmit-mode"
来源:https://stackoverflow.com/questions/13585131/keyboard-transmit-mode-in-vt100-terminal-emulator