Feature #5785

Readline に pre_input_hook, insert_text, redisplay を追加

Added by Tomoyuki Chikanaga over 3 years ago. Updated almost 3 years ago.

[ruby-dev:45018]
Status:Closed
Priority:Normal
Assignee:Kouji Takao

Description

拡張ライブラリ readline で補完時の処理をカスタマイズするため rl_pre_input_hook, rl_insert_text, rl_redisplay をサポートして欲しいです。
叩き台としてパッチを添付します。

readline_pre_input_hook.patch Magnifier (6.31 KB) Tomoyuki Chikanaga, 12/21/2011 06:39 PM

readline_pre_input_hook2.patch Magnifier (6.45 KB) Tomoyuki Chikanaga, 01/12/2012 11:27 AM

Associated revisions

Revision 35513
Added by Kouji Takao about 3 years ago

  • ext/readline/readline.c (Readline.pre_input_hook) (Readline.insert_text, Readline.redisplay): new function. An original patch was created by nagachika. [Feature #5785]

Revision 35513
Added by Kouji Takao about 3 years ago

  • ext/readline/readline.c (Readline.pre_input_hook) (Readline.insert_text, Readline.redisplay): new function. An original patch was created by nagachika. [Feature #5785]

Revision 36131
Added by Yui NARUSE almost 3 years ago

Skip Readline 4.3. [Feature #5785]

Revision 36131
Added by Yui NARUSE almost 3 years ago

Skip Readline 4.3. [Feature #5785]

History

#1 Updated by Tomoyuki Chikanaga over 3 years ago

trunk の変更でパッチがあたらなくなっていたので udpate したものを再度添付します。

#2 Updated by Shyouhei Urabe about 3 years ago

  • Status changed from Open to Assigned

#3 Updated by Kouji Takao about 3 years ago

  • Status changed from Assigned to Closed

#4 Updated by Kouji Takao about 3 years ago

  • Status changed from Closed to Rejected

#5 Updated by Kouji Takao about 3 years ago

  • Target version set to 2.0.0
  • Due date set to 05/02/2012
  • Status changed from Rejected to Assigned

すみません。#1823にコメントするつもりが間違ってこちらにコメントしてしまいました。
さっさと、これを実装します。
パッチをいただき、ありがとうございます。

#6 Updated by Kouji Takao about 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35513.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/readline/readline.c (Readline.pre_input_hook) (Readline.insert_text, Readline.redisplay): new function. An original patch was created by nagachika. [Feature #5785]

#7 Updated by Kouji Takao about 3 years ago

少し補足します。

オリジナルのパッチから以下の修正をしています。

  • ユニットテストのtest_modify_text_in_pre_input_hookの出力結果(stdout.read)の期待値を"> hello world\n"に修正しました。
  • rl_pre_insert_hookのsetterとgetterの名前はReadline.pre_insert_hookにしました。
  • RDocを記述しました。

以上です。
なにわともあれパッチを提供いただきありがとうございました。
何か問題がありましたら、遠慮なくレポートしてください。

#8 Updated by Yui NARUSE about 3 years ago

  • Status changed from Closed to Assigned

kouji (Kouji Takao) wrote:

This issue was solved with changeset r35513.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/readline/readline.c (Readline.pre_input_hook) (Readline.insert_text, Readline.redisplay): new function. An original patch was created by nagachika. [Feature #5785]

このコミット以降、boron にて以下のようにテストに失敗しています。
+ ) Failure:
+test_modify_text_in_pre_input_hook(TestReadline) [/extdisk/chkbuild/chkbuild/tmp/build//ruby/test/readline/test_readline.rb:386]:
+<"> hello world\n"> expected but was
+<"> ">.
http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20120501T132800Z.diff.html.gz

boron (Debian squeeze 6.0.4) は Readline 4.3 を使っているのですが、これだと
naruse@boron:~/ruby$ ./ruby -rreadline -e'Readline.input=open("version.h");Readline.readline("> ")'

のようにエコーバックされず、6.1 とかだと、
% ./ruby -rreadline -e'Readline.input=open("/home/naruse/ruby/version.h");Readline.readline("> ")'
#define RUBY_VERSION "2.0.0"
と、入力が表示されるようです。

#9 Updated by Yui NARUSE almost 3 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r36131.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


Skip Readline 4.3. [Feature #5785]

Also available in: Atom PDF