Xterm.js: 'restore cursor' 恢复位置但不恢复文本属性

创建于 2018-06-20  ·  4评论  ·  资料来源: xtermjs/xterm.js

我在使用某些 VT100 转义序列时遇到了一些问题:

  • 保存光标 (ESC 7) (DECSC)
  • 恢复光标 (ESC 8) (DECRC)

通常, VT100 终端在编写保存光标转义序列时应保存光标位置以及字符属性
写入恢复游标时应恢复字符属性。

目前,保存和恢复光标的位置,但不保存和恢复

我已经在其他 VT100 实现上测试了保存/恢复转义序列的行为,以确保它们正在处理它:

我将在下面提供一些详细信息,并将开始研究解决方案,因为我自己需要它。
继续伟大的工作!

细节

  • 浏览器和浏览器版本: Chromium:版本 62.0.3202.89(Developer Build)建立在 Debian buster/sid 上,在 Debian buster/sid(64 位)上运行
  • 操作系统版本: debian buster/sid
  • xterm.js 版本: 3.4.1

重现步骤

这是用于测试的 VT100 转义序列:

\x1b[0m (attributes off)
\x1b[1;1f (reset origin)
\x1b[2J (clear)
\x1b7 (save cursor state)
\x1b[7m (set negative color)
                        <colored> (just some output)
\x1b8 (restore cursor state)
<should not be colored>\n\r (another output - will be printed in negative color in xtermjs)

使用xtermjs,“不应该被着色”被着色

xterm.write('\x1b[0m\x1b[1;1f\x1b[2J\x1b7\x1b[7m                        <colored>\x1b8<should not be colored>\n\r');
// will print:
// "<should not be colored> <colored>"

在 bash 中,“不应该被着色”不会被着色

printf '\x1b[0m\x1b[1;1f\x1b[2J\x1b7\x1b[7m                        <colored>\x1b8<should not be colored>\n\r'
# will print
# "<should not be colored> <colored>"

怎么修

在我看来,文本属性应该与位置一起保存和恢复,这里
这是 hterm 如何处理保存/恢复游标

编辑
所有字符属性(fg 颜色、bg 颜色和特殊标志模式:粗体、斜体、负数、..)都存储在“终端”类的“curAttr”属性中。 保存此属性的副本应该足以一次恢复所有字符属性。

help wanted typbug

最有用的评论

如果不是,我们应该为它创建一个单独的问题。 捕获所有这些可能应该在ICursorState状态对象中完成,以保持组织有序。

所有4条评论

VTE 曾经也有问题; 也许您可以在VTE 731205 中找到一些有趣的

@7PH由于您无论如何都在修改 DECSC,也许您可​​以查看https://vt100.net/docs/vt510-rm/DECSC.html ,还有一些终端属性仍然缺失,也应该处理。

如果不是,我们应该为它创建一个单独的问题。 捕获所有这些可能应该在ICursorState状态对象中完成,以保持组织有序。

合并在 PR 中并将其余属性分叉到https://github.com/xtermjs/xterm.js/issues/1526

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

pfitzseb picture pfitzseb  ·  3评论

Mlocik97-issues picture Mlocik97-issues  ·  3评论

jestapinski picture jestapinski  ·  3评论

kolbe picture kolbe  ·  3评论

circuitry2 picture circuitry2  ·  4评论