Cygwin的bash和ANSI控制序列 [英] Cygwin BASH and ANSI control sequences
问题描述
下面几件事情:
- 任何人都可以点我在C code到去code ANSI控制台转义序列?
- 有没有办法让Cygwin的BASH来模拟一个愚蠢的老TTY?
也许这应该是2个问题。
Maybe this should be 2 questions.
感谢。
推荐答案
这是一个有点间接的答案,但在GNU ncurses库处理各种终端。找出哪些控制序列适用于ANSI终端将是一个反编译ANSI终端描述的一种方法:
It's a somewhat indirect answer, but the GNU ncurses library handles terminals of all sorts. One way of finding out which control sequences are applicable to ANSI terminals would be to decompile an ANSI terminal description:
infocmp ansi
这会给你组用于通过诅咒的程序,以达到ANSI终端上的影响的terminfo属性。当然,你就必须知道这些象形文字的意思。
This would give you the set of terminfo attributes that are used by curses programs to achieve effects on an ANSI terminal. Of course, you then have to know what those hieroglyphs mean.
在Cygwin的,我得到了:
On Cygwin, I got:
$ infocmp ansi
# Reconstructed via infocmp from file: /usr/share/terminfo/61/ansi
ansi|ansi/pc-term compatible with color,
am, mc5i, mir, msgr,
colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
acsc=+\020\,\021\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J,
cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B,
cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P,
dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
el1=\E[1K, home=\E[H, hpa=\E[%i%p1%dG, ht=\E[I, hts=\EH,
ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J,
indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcbt=\E[Z, kcub1=\E[D,
kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L,
mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, op=\E[39;49m,
rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rin=\E[%p1%dT,
rmacs=\E[10m, rmpch=\E[10m, rmso=\E[m, rmul=\E[m,
s0ds=\E(B, s1ds=\E)B, s2ds=\E*B, s3ds=\E+B,
setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, smso=\E[7m,
smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd,
$
的 \\ E
符号指的是ESC字符。
The '\E
' notation refers to the ESC character.
如果做不到这一点,你可以看看了标准本身。
Failing that, you could look up the standard itself.
这篇关于Cygwin的bash和ANSI控制序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!