Issue #6456 has been updated by Glass_saga (Masaki Matsushita).

Status changed from Assigned to Third Party's Issue

Readline.point????????GNU readline???????rl_point??????????次????????????????証????????????

#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>

int 
main() {
    const char *prompt = "> ";
    char *line = NULL;

    while (line = readline(prompt)) {
        add_history(line);
        printf("%d: \"%s\"\n", rl_point, line);
        free(line);
    }

    clear_history();

    return EXIT_SUCCESS;
}

% ./a.out
> hoge
4: "hoge"
> hogefuga # 履歴??????"hoge"???復?????"fuga"???追??
4: "hogefuga"
> hogefuga # 履歴??????"hogefuga"???復??
8: "hogefuga"

以???????????????????示??????????GNU readline??????????????????????????????????????????
----------------------------------------
Bug #6456: [readline] Readline.point when history edited
https://bugs.ruby-lang.org/issues/6456#change-38294

Author: no6v (Nobuhiro IMAI)
Status: Third Party's Issue
Priority: Normal
Assignee: kouji (Kouji Takao)
Category: ext
Target version: 
ruby -v: ruby 2.0.0dev (2012-05-19 trunk 35705) [x86_64-linux]


=begin
以?????????????履歴??????????編??????????????? Readline.point ?????????????????????????????????

 require "readline"
 
 RUBY_DESCRIPTION  # => "ruby 2.0.0dev (2012-05-19 trunk 35705) [x86_64-linux]"
 Readline::VERSION # => "6.2"
 
 IO.pipe do |r, w|
   Readline.input = r
   w << "123\n\cP456\n\cP\n"
   Readline.readline("", true) # => "123"
   Readline.point              # => 3
   Readline.readline("", true) # => "123456"
   Readline.point              # => 3
   Readline.readline("", true) # => "123456"
   Readline.point              # => 6
 end
 # >> 123
 # >> 123456
 # >> 123456
=end



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