diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-08 01:54:38 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-08 01:54:38 +0000 |
commit | 4051fadb54cd1c00bc0170b753cd78351d5f9eb2 (patch) | |
tree | 1c8aea3ac39b83fd312c5d7c8bc0132c700d0505 | |
parent | 1a4d128124a2487a50f3a33e3f5e1e7dbde0acb6 (diff) |
merge revision(s) 33626:
* ext/readline/readline.c (Init_readline): like r18313, libedit's
replace_history_entry may use offset instead of which.
so introduce history_replace_offset_func and initialize it.
* ext/readline/readline.c (hist_set): use history_replace_offset_func.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/readline/readline.c | 11 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 18 insertions, 3 deletions
@@ -1,3 +1,11 @@ +Wed Feb 8 10:52:51 2012 NARUSE, Yui <naruse@ruby-lang.org> + + * ext/readline/readline.c (Init_readline): like r18313, libedit's + replace_history_entry may use offset instead of which. + so introduce history_replace_offset_func and initialize it. + + * ext/readline/readline.c (hist_set): use history_replace_offset_func. + Wed Feb 8 10:52:36 2012 NARUSE, Yui <naruse@ruby-lang.org> * ext/readline/readline.c (Init_readline): fix wrong condition. diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 7480feccc6..3114b38bd3 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -69,6 +69,7 @@ static ID id_orig_prompt, id_last_prompt; #endif static int (*history_get_offset_func)(int); +static int (*history_replace_offset_func)(int); #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER static int readline_completion_append_character; #endif @@ -1308,7 +1309,7 @@ hist_set(VALUE self, VALUE index, VALUE str) i += history_length; } if (i >= 0) { - entry = replace_history_entry(i, RSTRING_PTR(str), NULL); + entry = replace_history_entry(history_replace_offset_func(i), RSTRING_PTR(str), NULL); } if (entry == NULL) { rb_raise(rb_eIndexError, "invalid index"); @@ -1623,6 +1624,7 @@ Init_readline() */ rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp); history_get_offset_func = history_get_offset_history_base; + history_replace_offset_func = history_get_offset_0; #if defined HAVE_RL_LIBRARY_VERSION version = rb_str_new_cstr(rl_library_version); #if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY @@ -1632,7 +1634,12 @@ Init_readline() if (history_get(history_get_offset_func(0)) == NULL) { history_get_offset_func = history_get_offset_0; } -#if defined HAVE_CLEAR_HISTORY +#ifdef HAVE_REPLACE_HISTORY_ENTRY + if (replace_history_entry(0, "a", NULL) == NULL) { + history_replace_offset_func = history_get_offset_history_base; + } +#endif +#ifdef HAVE_CLEAR_HISTORY clear_history(); #else { @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 60 +#define RUBY_PATCHLEVEL 61 #define RUBY_RELEASE_DATE "2012-02-08" #define RUBY_RELEASE_YEAR 2012 |