ESC [?1c 转义序列在 Linux 控制台上有什么作用?
What does the ESC [?1c escape sequence do on the Linux console?
在尝试使 vim
在我的操作系统控制台上正常工作时,我注意到它在滚动之前向 stdout
写入以下转义序列:\x1b[?1c
。
问题是我无法在任何地方找到该特定序列的含义。我检查过:
- http://man7.org/linux/man-pages/man4/console_codes.4.html
- http://en.wikipedia.org/wiki/ANSI_escape_code
- https://vt100.net/docs/vt102-ug/appendixc.html
- https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
谁能帮我解开这个谜?
P.S。如果某些其他上下文可能有所帮助,则在以下上下文中使用该序列:
\x1b[?25l\x1b[?1c\x1b[3;24r\x1b[3;1H\x1b[L
使用来源。 Linux 内核句柄 \x1b[?1c
in this chunk:
case 'c':
if (vc->vc_ques) {
if (vc->vc_par[0])
vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
else
vc->vc_cursor_type = cur_default;
return;
}
break;
并且从上下文中,您可能会理解 vc_par
是一个参数数组(在这种情况下它只是 1
)。所以它将 vc_cursor_type
设置为 1。
根据 Linux soft cursor 的文档,这会使光标不可见:
first Parameter
specifies cursor size:
0=default
1=invisible
2=underline,
...
8=full block
+ 16 if you want the software cursor to be applied
+ 32 if you want to always change the background color
+ 64 if you dislike having the background the same as the
foreground.
在上下文中,vim 在 \x1b[?25l
之后(使光标隐藏)和更改滚动区域 \x1b[3;24r
之前(这将 移动 光标),这个序列只是添加了保险,因为序列在 Linux 控制台上执行时不会有光标闪烁。
示例中引用的链接中,只有 console_codes(4)
is relevant. It does not appear there because the soft cursor feature was added later than the original manual page, and it did not occur to others later when revising the manual page. (Actually no one's done any recent improvements to it, as noted in a recent discussion).
在尝试使 vim
在我的操作系统控制台上正常工作时,我注意到它在滚动之前向 stdout
写入以下转义序列:\x1b[?1c
。
问题是我无法在任何地方找到该特定序列的含义。我检查过:
- http://man7.org/linux/man-pages/man4/console_codes.4.html
- http://en.wikipedia.org/wiki/ANSI_escape_code
- https://vt100.net/docs/vt102-ug/appendixc.html
- https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
谁能帮我解开这个谜?
P.S。如果某些其他上下文可能有所帮助,则在以下上下文中使用该序列:
\x1b[?25l\x1b[?1c\x1b[3;24r\x1b[3;1H\x1b[L
使用来源。 Linux 内核句柄 \x1b[?1c
in this chunk:
case 'c':
if (vc->vc_ques) {
if (vc->vc_par[0])
vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
else
vc->vc_cursor_type = cur_default;
return;
}
break;
并且从上下文中,您可能会理解 vc_par
是一个参数数组(在这种情况下它只是 1
)。所以它将 vc_cursor_type
设置为 1。
根据 Linux soft cursor 的文档,这会使光标不可见:
first Parameter specifies cursor size: 0=default 1=invisible 2=underline, ... 8=full block + 16 if you want the software cursor to be applied + 32 if you want to always change the background color + 64 if you dislike having the background the same as the foreground.
在上下文中,vim 在 \x1b[?25l
之后(使光标隐藏)和更改滚动区域 \x1b[3;24r
之前(这将 移动 光标),这个序列只是添加了保险,因为序列在 Linux 控制台上执行时不会有光标闪烁。
示例中引用的链接中,只有 console_codes(4)
is relevant. It does not appear there because the soft cursor feature was added later than the original manual page, and it did not occur to others later when revising the manual page. (Actually no one's done any recent improvements to it, as noted in a recent discussion).