发信人: monopoly (MN国庆回来还要带鱼片么?), 信区: BBS_Help
标 题: 终端体验之旅(三)
发信站: 日月光华 (2005年09月18日13:28:37 星期天), 站内信件
为了知晓这些特殊按键发送的字符串,我们想一个办法,
让以<Esc>开头的组合键字符串,变成可见的字符串。
在编辑状态下按<Esc>,再按<PageUp>,出现什么?对,就是*[5~。
按下<PageUp>时发送的一个<Esc>,和之前我们特地按下的<Esc>一起,
让系统返回*,后面跟的就是按下<PageUp>时跟在<Esc>之后发送的字符串[5~。
因此我们可以推断,按下<PageUp>时键盘向系统发送的字符串是^[[5~。
虽然我们经过测试,知道了按下这些特殊按键后,终端向服务器发送的具体字符串,
但我们还不知道键盘向PC主机发送的具体字符串是什么。
键盘属于标准输入设备,应该有确定、唯一的标准。 //在此先请达人相助!
同样的功能键,经由不同的终端发送到BBS服务器,可能是以不同的形式。
但无论哪种终端发送的形式,在其他终端下使用,都具有相同的效果。
以下列表仅测试于WinXP Telnet及Sterm 2.549、Fterm 2.5.0133、Cterm 3.21 beta2下,
其他终端类型或版本未经测试。
所有特殊按键均以<Esc>发送的27号ASCII字符开头,下表中反转义为^[。
按键 Telnet Sterm Fterm Cterm 其他允许替代键
Esc ^[ ^[ ^[ ^[
Home ^[[1~ ^[[1~ ^[[1~ ^[[1~ ^[O1~
Insert ^[[2~ ^[[2~ ^[[2~ ^[[2~ ^[O2~
Delete chr(127)^[[3~ ^[[3~ ^[[3~ ^[O3~
End ^[[4~ ^[[4~ ^[[4~ ^[[4~ ^[O4~
PageUp ^[[5~ ^[[5~ ^[[5~ ^[[5~ ^[O5~
PageDown ^[[6~ ^[[6~ ^[[6~ ^[[6~ ^[O6~
↑ ^[[A ^[OA ^[[A ^[[A
↓ ^[[B ^[OB ^[[B ^[[B
→ ^[[C ^[OC ^[[C ^[[C
← ^[[D ^[OD ^[[D ^[[D
F1 ^[OP ^[OP ^[[11~ ×
F2 ^[OQ ^[OQ ^[[12~ ×
F3 ^[OR ^[OR ^[[13~ ×
F4 ^[OS ^[OS ^[[14~ ×
F5 ^[[15~ ^J <Null> ×
F6 ^[[17~ ^[[17~ ^[[17~ ×
F7 ^[[18~ ^[[18~ ^[[18~ ×
F8 ^[[19~ ^[[19~ ^[[19~ ×
F9 ^[[20~ ^[[20~ ^[[20~ ×
F10 ^[[21~ ^[[21~ ^[[21~ ×
F11 ^[[23~ ^[[23~ ^[[22~ ×
F12 ^[[24~ ^[[24~ × ×
Ctrl+F1 ^[OP ^[OP ^[[k ×
Ctrl+F2 ^[OQ ^[OQ ^[[l ×
Ctrl+F3 ^[OR ^[OR ^[[m ×
Ctrl+F4 ^[OS × × ×
Ctrl+F5 ^[[15~ ^J <Null> ×
Ctrl+F6 ^[[17~ <Null> ^[[p ×
Ctrl+F7 ^[[18~ ^[[18~ ^[[q ×
Ctrl+F8 ^[[19~ ^[[19~ ^[[r ×
Ctrl+F9 ^[[20~ ^[[20~ ^[[s ×
Ctrl+F10 ^[[21~ × ^[[t ×
Ctrl+F11 ^[[23~ ^[[23~ <Null> ×
另:以下为Windows XP操作系统下的全局快捷键
Ctrl+Esc Win键
Ctrl+F12 ^C
部分特殊按键无任何响应,在上表中以<Null>列出;
部分特殊按键被用于终端软件的特殊用途,无法发送到服务器,在上表中以×列出。
这些特殊按键发送的字符串,都是以^[[或^[O打头的,这也被称为内码输入法。
(to be continued)
--
※ 转载:·日月光华 bbs.fudan.edu.cn·[FROM: 10.100.111.111]
※ 修改:·monopoly 於 09月18日14:25:08 修改本文·[FROM: 10.100.111.111]
Sender: monopoly MN Do you still need to bring fish fillets when you come back during the National Day? Message area: BBS Help
Title: Terminal Experience Journey 3
Sending site: Sun and Moon Guanghua September 18, 2005 13:28:37 Sunday, site mail
In order to know the strings sent by these special keys, let's think of a way
Make the key combination string starting with <Esc> a visible string
In editing mode, press <Esc> and then press <PageUp>. What will appear? Yes, it is *[5
An <Esc> sent when <PageUp> is pressed together with the <Esc> we specifically pressed before
Let the system return * followed by the string sent after <Esc> when <PageUp> is pressed [5
Therefore we can infer that the string sent by the keyboard to the system when <PageUp> is pressed is ^[[5
Although we have tested and know the specific strings sent by the terminal to the server after pressing these special keys,
But we don’t yet know what specific string the keyboard sends to the PC host
The keyboard is a standard input device and there should be a definite and unique standard. Please help me first.
The same function key is sent to the BBS server via different terminals, possibly in different forms.
But no matter which terminal sends the form, it will have the same effect when used in other terminals.
The following list is only tested under WinXP Telnet and Sterm 2.549 Fterm 2.5.0133 Cterm 3.21 beta2
Not tested with other terminal types or versions
All special keys start with ASCII character No. 27 sent by <Esc>. In the table below, the reverse escape is ^[
Key Telnet Sterm Fterm Cterm Other allowed substitution keys
Esc ^[ ^[ ^[ ^[
Home ^[[1 ^[[1 ^[[1 ^[[1 ^[O1
Insert ^[[2 ^[[2 ^[[2 ^[[2 ^[O2
Delete chr 127 ^[[3 ^[[3 ^[[3 ^[O3
End ^[[4 ^[[4 ^[[4 ^[[4 ^[O4
PageUp ^[[5 ^[[5 ^[[5 ^[[5 ^[O5
PageDown ^[[6 ^[[6 ^[[6 ^[[6 ^[O6
^[[A ^[OA ^[[A ^[[A
^[[B ^[OB ^[[B ^[[B
^[[C ^[OC ^[[C ^[[C
^[[D ^[OD ^[[D ^[[D
F1 ^[OP ^[OP ^[[11
F2 ^[OQ ^[OQ ^[[12
F3 ^[OR ^[OR ^[[13
F4 ^[OS ^[OS ^[[14
F5 ^[[15 ^J <Null>
F6 ^[[17 ^[[17 ^[[17
F7 ^[[18 ^[[18 ^[[18
F8 ^[[19 ^[[19 ^[[19
F9 ^[[20 ^[[20 ^[[20
F10 ^[[21 ^[[21 ^[[21
F11 ^[[23 ^[[23 ^[[22
F12 ^[[24 ^[[24
Ctrl F1 ^[OP ^[OP ^[[k
Ctrl F2 ^[OQ ^[OQ ^[[l
Ctrl F3 ^[OR ^[OR ^[[m
Ctrl F4 ^[OS
Ctrl F5 ^[[15 ^J <Null>
Ctrl F6 ^[[17 <Null> ^[[p
Ctrl F7 ^[[18 ^[[18 ^[[q
Ctrl F8 ^[[19 ^[[19 ^[[r
Ctrl F9 ^[[20 ^[[20 ^[[s
Ctrl F10 ^[[21 ^[[t
Ctrl F11 ^[[23 ^[[23 <Null>
In addition, the following are global shortcut keys under the Windows XP operating system
Ctrl Esc Win key
Ctrl F12 ^C
Some special keys have no response and are listed with <Null> in the above table.
Some special keys are used for special purposes in the terminal software and cannot be sent to the server. They are listed with in the table above.
The strings sent by these special keys all start with ^[[ or ^[O. This is also called the internal code input method.
to be continued
Reprint: Sun and Moon Guanghua bbs.fudan.edu.cn [FROM: 10.100.111.111]
Modification: monopoly modified this article at 14:25:08 on September 18th [FROM: 10.100.111.111]