完整可滚动窗口内容的xterm转储 [英] xterm dump of full scrollable window content

查看:161
本文介绍了完整可滚动窗口内容的xterm转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人知道在Linux的xterm窗口中转储或复制全部可见消息的方法。非常重要的一点是,我不想知道如何发送命令并将其流输出到流1和2以及输入中,因为这是我所熟知的。

I want to know if anyone does know a way to dump or copy the whole lot of viewable messages in a xterm window on linux. The very important thing is I don't want to know how to send a command out and kapture its output for stream 1 and 2 as well as the input, as this is well known to me.

我可以解释一下这是什么。您在做某事时并没有预期的任何复杂性,但是却收到了msg的als err msg页面或正常输出。为了能够在以后看到它,您应该能够将它们保存在文件中,并且只要能够使用鼠标将它们全部滚动回来,就可以确定数据是否在某些地方。但是时间可能不是滚动,截屏和滚动...。

I may explain for what this is needed. You do something and expect not any complications but than you got pages of msg's als err msg or normal output. To be able to see later after it you should be able to get them in a file and as long as you are able to scroll that all back and forther with your mouse it is sure the data is there some where. But the time may be not to scroll and screenshot and scroll ....

在这种情况下,我很乐意为我提供帮助,并且完整视图,包括您自己的所有键入内容以及所有味精的排列顺序,与您向后滚动时所看到的顺序相同。

I would be glad to help me out in such cases and it would be fine to have the full view including all your own typing and all the msg's in same order as you watch it when you scroll it back.

我真的不知道它的存储位置以及如何保存它。我知道我可以转储全部内存并在xterm窗口中搜索它的一部分,但这在我认为的顶部上有点过分。

I don't really know where this is stored and how you could get that saved. I know that I could dump the whole lot of Memory and search it for a part of the xterm window, but that is a bit over the top I think.

推荐答案

有一个我忘记的控制序列。这个问题使我想起了。在 XTerm控制序列中,指出打印所有页面:

There is a control sequence, which I had forgotten. This question reminded me. In XTerm Control Sequences, it is noted "print all pages":

CSI ? Pm i
      Media Copy (MC, DEC-specific).
        Ps = 1  -> Print line containing cursor.
        Ps = 4  -> Turn off autoprint mode.
        Ps = 5  -> Turn on autoprint mode.
        Ps = 1  0  -> Print composed display, ignores DECPEX.
        Ps = 1  1  -> Print all pages.

该日期可以追溯到1999年(补丁#119 ),因此您很可能在xterm中使用了它。您可以在这样的shell命令中执行此操作:

That dates from 1999 (patch #119), so you likely have it in your xterm. You could do this in a shell command like this:

printf '\033[?11i'

评论提到页面 xterm的隐藏宝石 ,它使用相应的 action print-everything (可以通过翻译资源执行的操作)。当然,它在手册页中。相同的注释指向 XTerm printerCommand输出中的多余字符 ,其中提到了资源 printAttributes 。默认情况下,打印机的控制序列告诉xterm发送额外的控制字符(以重建视频属性)。可以修改该资源(将其设置为 0 )以禁止显示该资源。那甚至更老了(补丁#74 )。

A comment mentions the page Hidden gems of xterm, which uses the corresponding action print-everything (something that can be executed via the translations resource). It is in the manual page, of course. The same comment points to Extra characters in XTerm printerCommand output, which mentions the resource printAttributes. By default, the control sequences for the printer tell xterm to send extra control characters (to reconstruct video attributes). The resource can be modified (set to 0) to suppress that. That is even older (patch #74).

没有这个—可以想象,一个可以构造一个应用程序,该应用程序使用X SendEvent协议来构造一系列事件,这些事件将被解释为xterm动作以回滚,选择文本并通过剪贴板逐块复制。您甚至可以用Perl编写它(有一个 X协议的模块)。

Without that — Conceivably one could construct an application which used the X SendEvent protocol to construct a series of events which would be interpreted as xterm actions to scroll back, select text and copy it chunk-by-chunk via the clipboard. You could even write it in Perl (there is a module for X protocol). But seriously, no.

如果要捕获写入xterm的文本,可以通过在需要 之前进行准备来实现。通过不同的方法(请参见手册):

If you want to capture text which was written to xterm, you can do this by preparing before the text is needed by different methods (see manual):


  • 打开xterm日志记录功能(不是用户友好的,因为它会生成文件名)。可以使用登录到文件(日志记录) 菜单项启用该功能。

  • 使用打印机控制序列在写入行时进行写入(同样,不是那么友好,尽管有一个菜单项可以打开和关闭它,重定向到打印机(打印redir)

  • 使用 script 到将 all 输出捕获到终端。我之所以使用它,是因为它可与任何类似POSIX的系统(甚至Cygwin)上的任何终端一起使用。

  • turn on the xterm logging feature (not that user-friendly because it generates the filename). This can be enabled using the "Log to File (logging)" menu entry.
  • use the printer control sequences to write lines as they are written (again, not that friendly, though there is a menu entry to turn it on and off, "Redirect to Printer (print-redir)")
  • use script to capture all output to the terminal. I use this, because it works with any terminal on any POSIX-like system (even Cygwin).

每种方法都会产生一个包含转义/控制序列的文件,需要进行过滤。假设使用SendEvent的程序原则上可以消除这种情况。

Each of these methods produces a file containing escape/control sequences, which requires filtering out. The hypothetical program using SendEvent could in principle eliminate that.

这篇关于完整可滚动窗口内容的xterm转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆