[前][次][番号順一覧][スレッド一覧]

ruby-changes:22428

From: naruse <ko1@a...>
Date: Wed, 8 Feb 2012 10:54:52 +0900 (JST)
Subject: [ruby-changes:22428] naruse:r34477 (ruby_1_9_3): merge revision(s) 33626:

naruse	2012-02-08 10:54:38 +0900 (Wed, 08 Feb 2012)

  New Revision: 34477

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34477

  Log:
    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.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/ext/readline/readline.c
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34476)
+++ ruby_1_9_3/ChangeLog	(revision 34477)
@@ -1,3 +1,11 @@
+Wed Feb  8 10:52:51 2012  NARUSE, Yui  <naruse@r...>
+
+	* 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@r...>
 
 	* ext/readline/readline.c (Init_readline): fix wrong condition.
Index: ruby_1_9_3/ext/readline/readline.c
===================================================================
--- ruby_1_9_3/ext/readline/readline.c	(revision 34476)
+++ ruby_1_9_3/ext/readline/readline.c	(revision 34477)
@@ -69,6 +69,7 @@
 #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 @@
         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 @@
      */
     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 @@
 	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
 	{
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34476)
+++ ruby_1_9_3/version.h	(revision 34477)
@@ -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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]