在 gnu 屏幕会话中使用 less 时箭头键停止工作

发布于 2024-08-24 04:31:14 字数 202 浏览 3 评论 0原文

有时,当我在 screen 选项卡中使用 less 时,箭头键会显示 ^[OA^[OB^[OC^[OD 而不是做我希望他们做的事情。我可以做些什么来解决这个问题并再次获得对 less 的控制吗?

Sometimes when I am using less within a screen tab, the arrow keys display ^[OA, ^[OB, ^[OC, and ^[OD instead of doing what I want them to do. Is there something I can do to fix this and gain control of less again?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

枯叶蝶 2024-08-31 04:31:14

在 less 提示符下输入 !reset

enter !reset at the less prompt

谁的新欢旧爱 2024-08-31 04:31:14

我发现从内部屏幕重置有时并不能解决问题,因为它是外部客户端/shell,其状态实际上是混乱的并且屏幕从 reset 捕获控制字符并阻止它们到达外部客户端。在这种情况下,我必须分离我的会话(Ctrl+ad),运行reset,然后再次附加到会话 (screen -r)。

I have found that reset from within screen does not solve the problem sometimes, as it's the outer client/shell whose state is actually confused and screen captures the control characters from reset and prevents them from reaching the outer client. In this situation, I have to detach my session (Ctrl+a, d), run reset, then attach to the session again (screen -r).

尘世孤行 2024-08-31 04:31:14
  • 如果这种情况时常发生,则似乎某些应用程序(例如 catless 二进制文件)通过发送 控制字符。您需要从命令行运行reset命令来恢复。
  • 否则你必须欺骗你的终端应用程序。我建议您使用 CryptoTerm 它允许您定义自定义键映射。
  • If it happens from time to time, it seems, that some application (e.g. cat or less a binary file) shatters your console by sending it control characters. You need to run reset command from command line to recover.
  • Otherwise you have to trick your terminal application. I suggest you to use CryptoTerm which allows you to define custom key mappings.
鲸落 2024-08-31 04:31:14

另一件要检查的事情是你的 TERM 变量。就我而言,我通过 ssh 进入 Linux 机器并在屏幕内运行较少的内容 - TERM 变量设置为“屏幕” - 这会破坏箭头键。如果我这样少跑的话,它会完美地工作:

TERM=xterm less <file>

Another thing to check is your TERM variable. In my case I ssh into a Linux box and run less inside screen - the TERM variable was set to 'screen' - which breaks arrow keys. It works perfectly if I run less this way:

TERM=xterm less <file>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文