Skip to content

Instantly share code, notes, and snippets.

@koichiro
Created March 30, 2009 07:34
Show Gist options
  • Save koichiro/87676 to your computer and use it in GitHub Desktop.
Save koichiro/87676 to your computer and use it in GitHub Desktop.
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c (revision 23097)
+++ ext/readline/readline.c (working copy)
@@ -929,7 +929,24 @@
#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */
}
+/*
+ * 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;
+}
+
+
+static VALUE
hist_to_s(VALUE self)
{
return rb_str_new_cstr("HISTORY");
@@ -1230,6 +1247,8 @@
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment