Issue #212 has been updated by Kouji Takao.

File no212.patch added

= summary

This problem was investigated. 

As for GNU Readline's history_base and libedit's it, the treatment is different. 
GNU Readline's history_base = libedit's history_base - 1.

= example

== GNU Readline

HIST_ENTRY *entry;

add_history("1");
add_history("2");
add_history("3");

entry = history_get(history_base);
printf("%s\n", entry->line); /* => 1 */

entry = history_get(history_base + 1);
printf("%s\n", entry->line); /* => 2 */

entry = history_get(history_base + 2);
printf("%s\n", entry->line); /* => 2 */


== Editline Library

HIST_ENTRY *entry;

add_history("1");
add_history("2");
add_history("3");

entry = history_get(history_base - 1);
printf("%s\n", entry->line); /* => 1 */

entry = history_get(history_base);
printf("%s\n", entry->line); /* => 2 */

entry = history_get(history_base + 1);
printf("%s\n", entry->line); /* => 3 */

= try

I created the patch for this problem.
Try the patch.
1. Mac OSX 10.5(Leopard).
2. apply patch to ruby 1.8.
3. run configure with --enable-libedit.
4. run make.
5. run make install.
6. run below command.
$ ruby -rreadline -e 'puts Readline::VERSION; Readline::HISTORY.push("1", "2", "3"); Readline::HISTORY.each { |i| puts i }'

= environment

My environment.
* Mac OSX: 10.5.3
* ruby: ruby_1_8 branch(revision:18037, 2008-07-12 16:02:47 +0900 (Sat, 12 Jul 2008))
* libedit: $NetBSD: readline.h,v 1.18 2006/08/21 12:45:30 christos Exp $

----------------------------------------
http://redmine.ruby-lang.org/issues/show/212

----------------------------------------
http://redmine.ruby-lang.org