From: "Cs. Henk" Date: 2005-03-09T21:49:09+09:00 Subject: [PATCH] giving acces readline to rl_line_buffer --zCKi3GIZzVBPywwA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi! The patch attached gives acces ruby's readline to rl_line_buffer. It's essential for putting together a context sensitive completion. (Eg., in case of irb, filename completion within strings, method name/variable completion elsewhere). Csaba --zCKi3GIZzVBPywwA Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="readline-line_buffer.diff" diff -uNar ruby-orig/ext/readline/readline.c ruby/ext/readline/readline.c --- ruby-orig/ext/readline/readline.c 2005-03-03 23:47:37.000000000 -0700 +++ ruby/ext/readline/readline.c 2005-03-09 05:36:32.615770664 -0700 @@ -694,6 +694,16 @@ return result; } +static VALUE +readline_s_line_buffer(self) + VALUE self; +{ + rb_secure(4); + if (rl_line_buffer == NULL) + return Qnil; + return rb_tainted_str_new2(rl_line_buffer); +} + void Init_readline() { @@ -746,6 +756,7 @@ readline_s_set_filename_quote_characters, 1); rb_define_singleton_method(mReadline, "filename_quote_characters", readline_s_get_filename_quote_characters, 0); + rb_define_singleton_method(mReadline, "line_buffer", readline_s_line_buffer, 0); history = rb_obj_alloc(rb_cObject); rb_extend_object(history, rb_mEnumerable); --zCKi3GIZzVBPywwA--