Ruby Irb 对控制键的反应很奇怪
我对 Ruby 非常陌生,从今天开始。
我刚刚从系统的 Ruby 1.8 安装迁移到从源代码编译的 Ruby 1.9。这样一来,irb 的情况就变得更糟了。它以最不友好的方式对非字母数字控制键做出反应:
向上键打印:^[[A
向下键打印:^[[B
删除键打印:^[[3~
...等等。对我来说,这样做的主要结果是我无法访问以前发出的命令。制表符补全也不起作用;尽管这一切似乎都不是 Wirble 的问题 - 当我删除 ~/.irbrc 时也会发生同样的情况。
我正在使用:
- Ubuntu 9.10
- GNOME Terminal 2.28.1
- ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
- Irb version 0.9.5 (05/04/13)
有什么想法吗? :(
I'm (extremely) new to Ruby, having started today.
I just moved from my system's Ruby 1.8 installation to Ruby 1.9, compiled from source. In doing so, irb has taken a turn for the worse. It reacts in a most unfriendly way to the non-alphanumeric control keys:
UP key prints: ^[[A
DOWN key prints: ^[[B
DELETE key prints: ^[[3~
...and so on. The main result of this for me is that I have no access to previously issued commands. Nor does tab-completion work; though none of this seems to be an issue with Wirble - the same happens when I remove my ~/.irbrc.
I'm using:
- Ubuntu 9.10
- GNOME Terminal 2.28.1
- ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
- Irb version 0.9.5 (05/04/13)
Any ideas? :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是一个阅读线问题。您可以尝试安装 libreadline 和 libreadline-dev 软件包,然后重建 Ruby,看看是否有帮助:
This could be a readline issue. You could try installing libreadline and libreadline-dev packages and rebuild Ruby after that, see if it helps:
如果您使用 OS X Snow Leopard 并遇到同样的问题,这里有如何修复它的说明: http://snippets.dzone.com/posts/show/10511
If you use OS X Snow Leopard and have the same problem there is a description how to fix it here: http://snippets.dzone.com/posts/show/10511
readline 是正确的答案。只是想说,对于 os x,您可以通过 homebrew 安装 readline。
readline is the correct answer. just wanted to say that for os x, you can install readline via homebrew.