Index: ext/readline/readline.c =================================================================== --- ext/readline/readline.c (revision 18037) +++ ext/readline/readline.c (working copy) @@ -511,6 +511,12 @@ #endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */ } +#ifdef HAVE_EDITLINE_READLINE_H +#define HISTORY_BASE (history_base - 1) +#else +#define HISTORY_BASE (history_base) +#endif + static VALUE hist_to_s(self) VALUE self; @@ -531,7 +537,7 @@ if (i < 0) { i += history_length; } - entry = history_get(history_base + i); + entry = history_get(HISTORY_BASE + i); if (entry == NULL) { rb_raise(rb_eIndexError, "invalid index"); } @@ -649,7 +655,7 @@ rb_secure(4); for (i = 0; i < history_length; i++) { - entry = history_get(history_base + i); + entry = history_get(HISTORY_BASE + i); if (entry == NULL) break; rb_yield(rb_tainted_str_new2(entry->line));