https://bugs.ruby-lang.org/
https://bugs.ruby-lang.org/favicon.ico?1711330511
2012-05-21T19:24:44Z
Ruby Issue Tracking System
Ruby master - Bug #6456: [readline] Readline.point when history edited
https://bugs.ruby-lang.org/issues/6456?journal_id=26738
2012-05-21T19:24:44Z
mame (Yusuke Endoh)
mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>kouji (Kouji Takao)</i></li></ul>
Ruby master - Bug #6456: [readline] Readline.point when history edited
https://bugs.ruby-lang.org/issues/6456?journal_id=38294
2013-04-06T23:11:19Z
Glass_saga (Masaki Matsushita)
glass.saga@gmail.com
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Third Party's Issue</i></li></ul><p>Readline.pointの実体はGNU readlineの変数rl_pointですが、次のようなコードで検証したところ</p>
<p>#include <stdlib.h><br>
#include <stdio.h><br>
#include <readline/readline.h><br>
#include <readline/history.h></p>
<p>int<br>
main() {<br>
const char *prompt = "> ";<br>
char *line = NULL;</p>
<pre><code>while (line = readline(prompt)) {
add_history(line);
printf("%d: \"%s\"\n", rl_point, line);
free(line);
}
clear_history();
return EXIT_SUCCESS;
</code></pre>
<p>}</p>
<p>% ./a.out</p>
<blockquote>
<p>hoge<br>
4: "hoge"<br>
hogefuga # 履歴から"hoge"を復元し"fuga"を追記<br>
4: "hogefuga"<br>
hogefuga # 履歴から"hogefuga"を復元<br>
8: "hogefuga"</p>
</blockquote>
<p>以上のような挙動を示したので、GNU readline側の仕様ないしバグではないかと思われます。</p>