发信人: seaboy (要从太阳上取金子的化学家), 信区: ANSI
标 题: ASCII入门教程(四)——移位控制
发信站: 日月光华 (2003年04月02日19:33:50 星期三), 站内信件
移位,这个技术通常在签名档里用到的最多,因为签名档只能写六行的代码
如果你想作一个超过六行的签名档,那么你就需要用移位,来实现这个目的。
下面我就介绍一下有关移位的几个控制符,这些控制符对大小写敏感。
1、*[x;yH
这个控制符表示将其后面一行以内的内容移到第x行,第y列,移动后,下面
其他行的内容也会顺次移动,也就是从那行开始后面所有的内容作为一个整
体一起移动,*[x;y的坐标是从屏幕的左上角算起,左上角的坐标是*[1;1H
由于这个用法比较简单,所以不举例说明了。
2、*[nA *[nB *[nC *[nD
这四个控制符分别表示将光标上移n行,下移n行,右移n行,左移n行,举例说
明如下
“就*[4C像*[B*[6D这*[4C样”其效果就是
这 样
那么到底是如何移动的呢,我们可以假定一个光标,它的起始位置在“就”字
之后,“*[4C像”表示“像”字先向右移动了4个字符,再移动“这”字的时候
就要从“像”字后面的那个位置开始移动,“*[B”表示先向下移动一行(因为
移动一行或者一列的时候字母前的数字1可以省略不写),此时应该如下图所示:
“就 像
这”
然后“*[6C”表示还要向左移动6个字符,这样就成了:
“就 像
这”
最后“样”字就接着“这”字的位置移动,“*[4C”表示向右移动4个字符,这样
就移动完毕了,结果也就如下图所示了:
“就 像
这 样”
使用这几个控制符的关键就是搞清楚移动的方向和步数,如果有时候算不清楚的话
就按Esc+c来随时预览一下效果,然后再作出修正。
3、*[s和*[u
*[s光标保存控制符,将光标当前的位置保存下来,*[u光标恢复控制符,将光标恢
复到*[s保存光标的位置,打个比喻就像机器猫的随意门一样,可以将光标从一屏内
的任意地方一下恢复到最近的*[s处,就像穿过一道时空门一样,中间不管隔着多远。
举例说明如下:
测*[s
*[u试*[s
*[u一*[s
*[u下
效果就是:
测试一下
--
◢ ╭╮ ◆ │ ◣
ヽ ╰╮ │ ◤
◢ ┃╭┓╭╮┣╮╭┓┳╭ ◥
╯ ╰╯┣╯╰┻╰╯╰╯╰┫ ╰ ▼
◣ ◤ ╰╯ │ ◣
╰╯
※ 来源:·日月光华 bbs.fudan.edu.cn·[FROM: 10.100.107.130]
Sender: seaboy Chemist who wants to get gold from the sun, message area: ANSI
Title: ASCII Introductory Tutorial 4 Shift Control
Sending site: Sun and Moon Guanghua Wednesday, April 2, 2003 19:33:50, site mail
Shifting This technique is usually used most in signature files because signature files can only write six lines of code.
If you want to make a signature file with more than six lines, then you need to use shifting to achieve this purpose.
Next, I will introduce some control characters related to shifting. These control characters are case-sensitive.
1*[x;yH
This control character means that the content within one row after it is moved to the xth row and the yth column after the move.
The content of other rows will also be moved sequentially, that is, all the content starting from that row will be moved as a whole.
The bodies move together *[x;y coordinates are calculated from the upper left corner of the screen. The coordinates of the upper left corner are *[1;1H
Since this usage is relatively simple, I won’t give an example.
2 *[nA *[nB *[nC *[nD
These four control symbols respectively mean to move the cursor up n lines, down n lines, right n lines, and left n lines. For example
It is explained as follows
Just *[4C is like *[B*[6D this*[4C. The effect is
so
So how does it move? We can assume that a cursor starts at the word
After that, *[4C like represents the word like first moved 4 characters to the right, and then moved the word like
We need to start moving from the position behind the word like *[B means moving down one line first because
When moving a row or a column, the number 1 before the letter can be omitted. At this time, it should be as shown in the figure below
like
this
Then *[6C means to move 6 characters to the left. This becomes
like
this
Finally, the character "like" will be moved to the position of this character *[4C means moving 4 characters to the right, like this
The move is complete and the result is as shown in the picture below.
like
so
The key to using these control symbols is to figure out the direction of movement and the number of steps. If sometimes it is not clear,
Just press Esc c to preview the effect at any time and then make corrections.
3 *[s and *[u
*[s cursor save control character Save the current cursor position *[u cursor restore control character restore the cursor
Return to *[s to save the cursor position. An analogy is like Doraemon's random door. You can move the cursor from within a screen.
Anywhere in the world is instantly restored to the nearest *[s, just like passing through a space-time door, no matter how far apart there is.
Examples are as follows
Measure*[s
*[utest*[s
*[u一*[s
*[u下
The effect is
have a test
ヽ
Source: Sun and Moon Guanghua bbs.fudan.edu.cn [FROM: 10.100.107.130]