我在使用某些 VT100 转义序列时遇到了一些问题:
通常, VT100 终端在编写保存光标转义序列时应保存光标位置以及字符属性
写入恢复游标时应恢复字符属性。
我已经在其他 VT100 实现上测试了保存/恢复转义序列的行为,以确保它们正在处理它:
我将在下面提供一些详细信息,并将开始研究解决方案,因为我自己需要它。
继续伟大的工作!
这是用于测试的 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”属性中。 保存此属性的副本应该足以一次恢复所有字符属性。
VTE 曾经也有问题; 也许您可以在VTE 731205 中找到一些有趣的
@7PH由于您无论如何都在修改 DECSC,也许您可以查看https://vt100.net/docs/vt510-rm/DECSC.html ,还有一些终端属性仍然缺失,也应该处理。
如果不是,我们应该为它创建一个单独的问题。 捕获所有这些可能应该在ICursorState
状态对象中完成,以保持组织有序。
合并在 PR 中并将其余属性分叉到https://github.com/xtermjs/xterm.js/issues/1526
最有用的评论
如果不是,我们应该为它创建一个单独的问题。 捕获所有这些可能应该在
ICursorState
状态对象中完成,以保持组织有序。