Tag: readline

使用Clang安装Ruby 1.9.3故障

我试图在Mac OS X Lion上安装Ruby 1.9.3,方法与我在此处发现的相同: 基本上它是: rvm install 1.9.3 –with-gcc=clang –with-readline-dir=$rvm_path/usr 但是,这次Clang在–with-readline-dir选项上抛出错误: Larson:~ andrewjl$ rvm install 1.9.3 –with-gcc=clang –with-readline-dir=$rvm_path/usr clang: error: unsupported option ‘–with-readline’ clang: error: unsupported option ‘–with-opt-dir=/Users/andrewjl/.rvm/usr’ 这是Clang的问题吗? 有谁知道怎么解决这个问题? 编辑 在尝试Shigeya的答案后,我得到了这个错误: Larson:~ andrewjl$ rvm install 1.9.3-p125 –patch xcode-debugopt-fix-r34840.diff –with-readline-dir=$rvm_path/usr –with-openssl-dir=$rvm_path/usr –with-tcl-lib=/usr –with-tk-lib=/usr Installing Ruby from source to: /Users/andrewjl/.rvm/rubies/ruby-1.9.3-p125, this may take a while […]

irb中的单词边界

我在Snow Leopard上使用终端。 在命令行,如果我输入foo.bar.baz.bang.quuz.quux ,当我点击选项-B时,它会逐字地向后移动光标 – 在每个句点停止,因为它考虑了一个周期到是一个词边界。 同样,选项-F逐字逐句前进。 在irb(0.9.5,ruby 1.8.7)中,选项-B和-F也有此行为,但句点不再被视为单词边界,这使得这些键盘快捷键显着减少了用处。 我怎么能改变这个? 编辑:Curiouser和curiouser:在具有相同irb和ruby版本的EC2实例上,句点被视为单词边界。

如何将Readline支持编译到Ruby中

我的ruby版本是用editline编译的(在os x上)我错过了irb中readline的function。 如何使用readline支持重新编译ruby?

将文本粘贴到IRB非常慢。 Readline问题?

当我将以下文本粘贴到在ruby-enterprise-2011.03下运行的IRB或PRY时,需要13秒。 # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 在同一台计算机上运行irb与其他ruby安装时,粘贴速度并不慢。 jruby-1.5.6 jruby-1.6.3 ruby-1.8.6-p420 ruby-1.8.7-p352 ruby-1.9.1-p431 ruby-1.9.2-p290 ruby-1.9.3-preview1 or Mac OS X’s default system install of 1.8.7-p249 这个问题与Rails控制台在编辑文本时运行速度非常慢有关,但我没有使用rvm,在编写,编辑或删除文本时没有慢; 只有粘贴很慢。 @ fl00r的建议有效,但这不是永久修复。 此外,如果粘贴文本中有硬新行,则只有最后一行很慢。 例如,粘贴以下文本仅需约1.5秒 # Lorem ipsum dolor sit amet, consectetur adipisicing elit, # sed […]

尝试启动rails控制台时,为什么会出现Readline错误?

更新:我可能在尝试在其他地方找到解决方案时弄乱了我的系统。 我从零开始,安装Ruby 1.9.3顺利安装。 现在试着让ree-1.8.7和…一起玩得很好…… 我正在尝试使用RVM在Kubuntu上安装Ruby 1.9.3(我相信11.10)。 到目前为止,我一直有很多关于Readline的问题,但除此之外我找到了答案。 我用这种方式安装了Ruby 1.9.3: rvm install 1.9.3 # Install of ruby-1.9.3-p0 – #complete cd ~/.rvm/src/ruby-1.9.3-p0/ext/readline/ ~/.rvm/src/ruby-1.9.3-p0/ext/readline $ ../../ruby extconf.rb –with-editline-dir=”/usr” –with-readline-dir=”/usr” # any other way of doing this resulted in simply readline not being loaded when trying to start the console # I have libreadline6 and libreadline6-dev installed (and all […]

如何为rails控制台安装“readline”

好吧,我正在尝试运行“rails console”命令,但这是我得到的: /home/user/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError) from /home/user/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/irb/completion.rb:10 from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `require’ from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands/console.rb:3 from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:37:in `require’ from /home/user/.rvm/gems/ruby-1.8.7-p352/gems/railties-3.1.0/lib/rails/commands.rb:37 from script/rails:6:in `require’ from script/rails:6 如何安装“readline”并使其正常工作?

彩色输出打破了使用readline的换行

我正在使用Ruby中的readline为一些输出着色,但是我没有运气让换行正常工作。 例如: “\e[01;32mThis prompt is green and bold\e[00m > ” 期望的结果是: This prompt is green and bold > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 我实际得到的是: aaaaaaaaaaa is green and bold > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 如果我删除颜色代码,换行工作正常。 我知道使用bash,如果颜色代码被错误地终止,可能会发生这种情况,但我已经尝试了所有我能想到的东西,包括一些不同的gem,并且行为是相同的。 它也出现在具有不同版本Readline的多个系统上。 这个特殊项目使用rb-readline而不是C readline 。

Readline在rvm中不起作用 – Ubuntu 11.10

我在我的ubyntu 11.10上使用rvm。 我的readline无法正常工作,我尝试了ruby extconf.rb但它没有通过。 输出如下: $ ruby extconf.rb checking for tgetnum() in -lncurses… yes checking for readline/readline.h… yes checking for readline/history.h… yes checking for readline() in -lreadline… no checking for readline() in -ledit… no checking for editline/readline.h… no 我尝试安装libncurses5-dev和libreadline5-dev $ sudo apt-get install libncurses5-dev libreadline5-dev Reading package lists… Done Building dependency tree Reading state information… […]

IRB历史不适用于Ruby 2.3.0

我在OS X 10.11.4上通过rbenv安装了Ruby 2.3.0p0。 在IRB会议中,历史记录正常。 但是,我无法跨会话访问IRB历史记录。 我尝试了我的系统Ruby,2.0.0p648,IRB会话的历史记录工作正常。 我尝试通过rbenv安装相同版本的Ruby,它也有工作历史。 我在工作和非工作会话之间比较了IRB.conf的值,没有看起来IRB.conf (尽管奇怪的是,在这两种情况下, irb / ext / save-history.rb都是空白文件)。 查看我的.irb_history文件,它似乎被替换而不是附加了最新会话的命令。 我可以加载2.0.0 IRB会话并滚动这些命令就好了。 我已经尝试过rbenv irb历史记录中列出的答案没有成功保存 。 我也尝试了irb历史中选定的答案不起作用 。 我必须改变选定的答案来替换#nitems方法。 这表明正在从历史文件中读Readline::HISTORY ,并将其推送到Readline::HISTORY 。 但是,检查Readline::HISTORY没有显示任何内容。 通过Readline.readline将我的.irb_history中的前一行添加到Readline历史记录中,并指定add_hist = true,我可以破解历史。 但是,绝对不是将以前的命令添加到Readline的正确方法。 我知道我可以切换到像撬的东西,但我想弄明白这一点。 有关为什么命令没有添加到Readline的任何建议,以及如何更改它?

什么会给我一些像ruby readline的默认值?

如果我想在终端上输入一个已输入默认值的提示,我该怎么做? Ruby的标准Readline.readline()允许我设置历史记录但不填写默认值(据我所知,至少) 我想要这样的东西: 码: input = Readline.readline_with_default(‘>’, ‘default_text’) 安慰: > default_text|