发信人: monopoly (MN国庆回来还要带鱼片么?), 信区: BBS_Help
标 题: 终端体验之旅(二)
发信站: 日月光华 (2005年09月18日13:28:35 星期天), 站内信件
现在大家明白了,128个ASCII码,就是由主键盘区上的按键及组合按键发送的。
那么,现在标准键盘中其他区域的各个按键,又会向系统发送什么字符呢?
下面,隆重推出本次旅行的全程导游——位于所有键盘最左上角的<Esc>键!
<Esc>自我介绍:我就是Ctrl+[,发送ASCII码表里的27号字符(0x1B),
人称百变精灵、多面写手的组合键之王Escape键!
<Ctrl>组合键依据的是Ctrl+某字符,要比某字符本身的ASCII码小0x40(即64);
而<Esc>键与其不同,是真正的组合键。
它发送的^[(表示Ctrl+[,下同),被系统认为是组合键的开始。
我们最熟悉的组合键就是人称double Esc的ANSI彩色控制符,
其实<Esc>的0x1B才是这个控制符真正的ASCII代码。
在我们按第一下<Esc>时,系统认为你要发送以此打头的某个组合键;
当我们再次按下<Esc>时,系统才明白,你要的发送的就是<Esc>本身。
这样,BBS系统就在屏幕上显示一个*代表<Esc>这个ANSI控制符。
因此,我们在输入ANSI彩色控制符时,要按两下<Esc>,
而从终端上复制下来的彩色代码里,只有一个<Esc>。
BBS系统中和ANSI彩色相关的<Esc>组合键还包括:
Esc-b 设定背景色 Esc-f 设定前景色 Esc-r 还原色彩 Esc-c 显示彩色效果
前三者分别对应*[4xm,*[3xm,*[0m(x为设定的0-7的某种颜色)。
言归正传,大家还是要问,当我按下上下左右,Ins和Del,还有F1到F12这些键时,
到底发送啥字符啊?128个ANSI字符都被主键盘区占满了呀!
答案就是——按下这些按键,向系统发出的是以<Esc>开头的字符串,
这些特殊按键其实就是<Esc>组合键,为了方便而放在键盘上的。
(to be continued)
--
※ 转载:·日月光华 bbs.fudan.edu.cn·[FROM: 10.100.111.111]
※ 修改:·monopoly 於 09月18日13:35:54 修改本文·[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 2
Sending site: Sun and Moon Guanghua September 18, 2005 13:28:35 Sunday, site mail
Now everyone understands that the 128 ASCII codes are sent by the keys and key combinations on the main keyboard area.
So what characters will the keys in other areas of the standard keyboard send to the system?
Below, we solemnly introduce the full tour guide for this trip. The <Esc> key located in the upper left corner of all keyboards
<Esc>Introduce yourself I am Ctrl [Send character 27 in the ASCII code table 0x1B
Known as the ever-changing wizard, the king of key combinations for all-round writers, the Escape key
The <Ctrl> key combination is based on Ctrl. A certain character is 0x40 smaller than the ASCII code of the character itself, which is 64.
The <Esc> key is different from it and is a real key combination.
The ^[ it sends means Ctrl [the same below, which is considered by the system as the beginning of the key combination.
The key combination we are most familiar with is the ANSI color control character called double Esc.
In fact, 0x1B of <Esc> is the real ASCII code of this control character.
When we press <Esc> for the first time, the system thinks that you want to send a key combination starting with this
When we press <Esc> again, the system understands that what you want to send is <Esc> itself.
In this way, the BBS system will display an * representing the ANSI control character <Esc> on the screen.
Therefore, when we enter the ANSI color control character, we need to press <Esc> twice.
In the color code copied from the terminal, there is only one <Esc>
The <Esc> key combinations related to ANSI colors in the BBS system also include
Esc b Set background color Esc f Set foreground color Esc r Restore color Esc c Display color effect
The first three correspond to *[4xm *[3xm *[0m x is a certain color of 0 7 set
Closer to home, everyone still wants to ask, when I press the up, down, left, right, Ins, Del, and F1 to F12 keys
What characters are being sent? All 128 ANSI characters are occupied by the main keyboard area.
The answer is that pressing these keys sends a string starting with <Esc> to the system.
These special keys are actually the <Esc> key combination placed on the keyboard for convenience.
to be continued
Reprint: Sun and Moon Guanghua bbs.fudan.edu.cn [FROM: 10.100.111.111]
Modification: monopoly modified this article at 13:35:54 on September 18th [FROM: 10.100.111.111]