简体   繁体   English

未知的 ANSI 转义序列

[英]Unknown ANSI escape sequence

I'm trying to create a HTML terminal emulator.我正在尝试创建一个 HTML 终端仿真器。 With most of the formatting code I'm OK, pages like this are a great help.大多数格式化代码我都可以,这样的页面很有帮助。 However the line containing the prompt is strange (string, then the ASCII codes below):但是包含提示的行很奇怪(字符串,然后是下面的 ASCII 代码):

\e]0;pi@igor: ~{??}\e[01;32mpi@igor:[01;34m~ $  
####
27 93 48 59 112 105 64 105 103 111 114 58 32 126 7 27 91 48 49 59 51 50 109 112 105 64 105 103 111 114 27 91 48 48 109 58 27 91

First of all, at the beginning of the line there's this \e] (Esc + closing bracket.) sequence I don't see in the docs, With an opening bracket it would be better.首先,在该行的开头有这个 \e] (Esc +右括号。)序列我在文档中没有看到,使用左括号会更好。 but even that I can't find in the reference.但即使是我在参考资料中也找不到。

The next thing is that char code 7 that I replaced with {??} in the string.接下来是我在字符串中用 {??} 替换的字符代码 7。 Right after the prompt there's a single byte 7.在提示之后有一个字节 7。

The actual prompt here is这里的实际提示是

pi@igor:~ $ 

with formatting (and igor is a Raspberry Pi), so the string is perfectly fine (even if truncated by me) after the {??} part, ie char 7. But what is it before that?使用格式化(并且 igor 是 Raspberry Pi),所以字符串在 {??} 部分之后非常好(即使被我截断),即 char 7。但在那之前它是什么?

Edit: so yes, char 7 would be the bell in ASCII.编辑:是的,char 7 将是 ASCII 的钟声。 If it's that, why does it have the full prompt go with it?如果是这样,为什么它有完整的提示 go 呢?

It is setting the terminal title to pi@igor: ~ which is done by the first part \e]0;pi@igor: ~\a .它将终端标题设置为pi@igor: ~这是由第一部分\e]0;pi@igor: ~\a

The comment by dave_thompson_085 reports that this is an xterm sequence: dave_thompson_085的评论报告说这是一个 xterm 序列:

This is an xterm defined sequence, not ANSI or DEC.这是一个 xterm 定义的序列,而不是 ANSI 或 DEC。 See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands (and the top of the page where OSC is explained as ESC ] or \x9D).请参阅https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands (以及将 OSC 解释为 ESC 或 \x9D 的页面顶部)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM