summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authorkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-10 13:03:40 +0000
committerkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-10 13:03:40 +0000
commit257c314fbb34230aea4528fbc1276304f6c7575c (patch)
tree33b6b9e5c1fb1e54edcce878f4b2146e0b51f6cb /ext/readline
parent89fd52131942b4f5365194344ce32346ace5f112 (diff)
* ext/readline/extconf.rb: checked rl_refresh_line in readline.
* ext/readline/readline.c (readline_s_refresh_line): add new method, a patch from Koichiro Ohba. see [ruby-list:45922]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/extconf.rb1
-rw-r--r--ext/readline/readline.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index d3ccca6..512e28f 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -50,6 +50,7 @@ have_readline_func("rl_getc_function")
have_readline_func("rl_filename_completion_function")
have_readline_func("rl_username_completion_function")
have_readline_func("rl_completion_matches")
+have_readline_func("rl_refresh_line")
have_readline_var("rl_deprep_term_function")
have_readline_var("rl_completion_append_character")
have_readline_var("rl_basic_word_break_characters")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index d54a280..7a7fb30 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1043,6 +1043,26 @@ readline_s_get_filename_quote_characters(VALUE self, VALUE str)
#define readline_s_get_filename_quote_characters rb_f_notimplement
#endif
+#ifdef HAVE_RL_REFRESH_LINE
+/*
+ * call-seq:
+ * Readline.refresh_line -> nil
+ *
+ * Clear the current input line.
+ *
+ * Raises SecurityError exception if $SAFE is 4.
+ */
+static VALUE
+readline_s_refresh_line(self)
+{
+ rb_secure(4);
+ rl_refresh_line(0, 0);
+ return Qnil;
+}
+#else
+#define readline_s_refresh_line rb_f_notimplement
+#endif
+
static VALUE
hist_to_s(VALUE self)
{
@@ -1350,6 +1370,8 @@ Init_readline()
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, "refresh_line",
+ readline_s_refresh_line, 0);
history = rb_obj_alloc(rb_cObject);
rb_extend_object(history, rb_mEnumerable);