如何删除 xterm.js 中的最后一行
How to remove the last line in xterm.js
我正在尝试删除 xtermjs 终端的最后一行。在文档中我只找到了 clear
和 reset
方法,但我只想删除最后一行。
我根据这个question
的答案解决了这个问题
[2K erases the entire line your cursor is currently on
3[A moves your cursor up one line, but in the same column i.e. not
to the start of the line
\r brings your cursor to the beginning of the line (r is for rewind)
but does not erase anything
我最后用它来擦除最后一行:
terminal.write('\x1b[2K\r')
\x1b 是\033 的十六进制,因为我在使用八进制版本时出现此错误。
Octal literal in strict mode
我正在尝试删除 xtermjs 终端的最后一行。在文档中我只找到了 clear
和 reset
方法,但我只想删除最后一行。
我根据这个question
的答案解决了这个问题[2K erases the entire line your cursor is currently on
3[A moves your cursor up one line, but in the same column i.e. not to the start of the line
\r brings your cursor to the beginning of the line (r is for rewind) but does not erase anything
我最后用它来擦除最后一行:
terminal.write('\x1b[2K\r')
\x1b 是\033 的十六进制,因为我在使用八进制版本时出现此错误。
Octal literal in strict mode