Project

General

Profile

Feature #5784 » readline_special_prefixes.patch

nagachika (Tomoyuki Chikanaga), 12/21/2011 06:39 PM

View differences:

ext/readline/extconf.rb
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_event_hook")
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_sigwinch")
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_signals")
have_readline_var("rl_special_prefixes")
have_readline_func("rl_cleanup_after_signal")
have_readline_func("rl_free_line_state")
have_readline_func("rl_clear_signals")
ext/readline/readline.c
#if USE_INSERT_IGNORE_ESCAPE
static ID id_orig_prompt, id_last_prompt;
#endif
#if defined(HAVE_RL_SPECIAL_PREFIXES)
static ID id_special_prefixes;
#endif
#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION
# define rl_filename_completion_function filename_completion_function
......
#define readline_s_get_completer_word_break_characters rb_f_notimplement
#endif
#if defined(HAVE_RL_SPECIAL_PREFIXES)
static VALUE
readline_s_set_special_prefixes(VALUE self, VALUE str)
{
rb_secure(4);
if (!NIL_P(str)) {
OutputStringValue(str);
str = rb_str_dup_frozen(str);
RBASIC(str)->klass = 0;
}
rb_ivar_set(mReadline, id_special_prefixes, str);
if (NIL_P(str)) {
rl_special_prefixes = NULL;
}
else {
rl_special_prefixes = RSTRING_PTR(str);
}
return self;
}
static VALUE
readline_s_get_special_prefixes(VALUE self)
{
VALUE str;
rb_secure(4);
str = rb_ivar_get(mReadline, id_special_prefixes);
if (!NIL_P(str)) {
str = rb_str_dup_frozen(str);
RBASIC(str)->klass = rb_cString;
}
return str;
}
#else
#define readline_s_set_special_prefixes rb_f_notimplement
#define readline_s_get_special_prefixes rb_f_notimplement
#endif
#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
/*
* call-seq:
......
completion_proc = rb_intern(COMPLETION_PROC);
completion_case_fold = rb_intern(COMPLETION_CASE_FOLD);
#if defined(HAVE_RL_SPECIAL_PREFIXES)
id_special_prefixes = rb_intern("special_prefixes");
#endif
mReadline = rb_define_module("Readline");
rb_define_module_function(mReadline, "readline",
......
readline_s_get_filename_quote_characters, 0);
rb_define_singleton_method(mReadline, "refresh_line",
readline_s_refresh_line, 0);
rb_define_singleton_method(mReadline, "special_prefixes=",
readline_s_set_special_prefixes, 1);
rb_define_singleton_method(mReadline, "special_prefixes",
readline_s_get_special_prefixes, 0);
#if USE_INSERT_IGNORE_ESCAPE
CONST_ID(id_orig_prompt, "orig_prompt");
test/readline/test_readline.rb
["point"],
["set_screen_size", 1, 1],
["get_screen_size"],
["special_prefixes=", "$"],
["special_prefixes"],
]
method_args.each do |method_name, *args|
assert_raise(SecurityError, NotImplementedError,
......
# basic_quote_characters
# completer_quote_characters
# filename_quote_characters
# special_prefixes
def test_some_characters_methods
method_names = [
"basic_word_break_characters",
......
"basic_quote_characters",
"completer_quote_characters",
"filename_quote_characters",
"special_prefixes",
]
method_names.each do |method_name|
begin
(1-1/2)