Windows控制台虚拟终端序列提供了一种滚动屏幕缓冲区的方式吗?

huangapple go评论75阅读模式
英文:

Do Windows Console Virtual Terminal Sequences provide a way of scrolling the screen buffer?

问题

视口定位在此提到的链接中,出于某种原因,与例如使用鼠标滚轮滚动终端窗口不同。

我期望所讨论的虚拟终端序列将之前位于视口之外的行移动到视口内,并将之前位于视口内的行移出视口。但实际上,它会删除我期望移出的缓冲区中的行,并在我期望以前未显示的地方插入新行。

是否有一种方法可以执行与使用鼠标滚轮滚动相同的操作,但使用虚拟终端序列?SetConsoleWindowInfo 提供了此功能,但我希望尽可能使用虚拟终端序列。

实现我的目标的另一种方法是将光标位置设置为当前视口之外的坐标。然而,有关光标定位的虚拟终端序列仅在当前视口内工作。SetConsoleCursorPosition 提供了此功能。

英文:

The Viewport Positioning mentioned here for some reason doesn't work like for example scrolling a terminal window with a mouse wheel does.

I expected the Virtual Terminal Sequences in question to move lines that previously were outside the viewport into the viewport and move lines that previously were inside the viewport out of the viewport. Instead, it deletes the lines from the buffer I expected to be moved out and inserts new lines where I expected the previously not displayed lines to appear.

Is there a way to perform the same action as scrolling with the mouse wheel would but with Virtual Terminal Sequences? SetConsoleWindowInfo provides this functionality but I want to stick to Virtual Terminal Sequences if possible.

Another way of achieving my goal would be to set the cursor position to coordinates outside of the current viewport. The VTS for Cursor Positioning however work only within the current viewport. SetConsoleCursorPosition provides this functionality.

答案1

得分: 1

不,它不会这样做。正如控制台虚拟终端序列顶部所指出的

> 以下序列的行为基于VT100和衍生的终端仿真器技术,尤其是xterm终端仿真器。有关终端序列的更多信息可以在http://vt100.net和http://invisible-island.net/xterm/ctlseqs/ctlseqs.html找到。

虚拟终端的视口就像xterm的可见屏幕。控制序列会更新该视口,但(忽略从视口滚动出来的旧数据)不会从视口之外的数据更新视口。

与鼠标相关的控制序列仅用于启用鼠标事件(按钮点击、选择/粘贴),不会导致视口移动。

英文:

No, it doesn't do that. As noted at the top of Console Virtual Terminal Sequences

>The behavior of the following sequences is based on the VT100 and derived terminal emulator technologies, most specifically the xterm terminal emulator. More information about terminal sequences can be found at http://vt100.net and at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html.

The virtual terminal's viewport is like the visible screen of an xterm. Control sequences update that viewport, but (ignoring old data being scrolled out of the viewport) do not update the viewport from data outside the viewport.

The control sequences related to the mouse only are used for enabling mouse events (button-clicks, select/paste), and do not cause the viewport to move around.

huangapple
  • 本文由 发表于 2023年6月22日 04:19:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76526857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定