Macのrubyのreadlineに不具合がある!?(4)

Macのrubyのreadlineに不具合がある!?(3)の続き。

Editline Library (libedit) からたどることができるドキュメントを読もうと思ったが、閲覧できないようなのでソースを読むことにした。

libedit/readline/readline.h
未実装のAPIが分かった。

extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
                        emacs_meta_keymap,
                        emacs_ctlx_keymap;
extern int              rl_filename_completion_desired;
extern int              rl_ignore_completion_duplicates;
extern int              (*rl_getc_function)(FILE *);
extern VFunction        *rl_redisplay_function;
extern VFunction        *rl_completion_display_matches_hook;
extern VFunction        *rl_prep_term_function;
extern VFunction        *rl_deprep_term_function;
extern int              readline_echoing_p;
extern int              _rl_print_completions_horizontally;

int              rl_kill_text(int, int);
Keymap           rl_get_keymap(void);
void             rl_set_keymap(Keymap);
Keymap           rl_make_bare_keymap(void);
int              rl_generic_bind(int, const char *, const char *, Keymap);
int              rl_bind_key_in_map(int, Function *, Keymap);

あとは、GNU Readline の互換ライブラリということなので、同様のAPIで同様に動くのだろう。
ただし、マルチバイト文字を正しく扱うことができないようだ。

Bugs

At the moment libedit does not support UTF-8 and multi-byte character sets. This
thread on the netbsd-users mailing list outlines what's missing: Problems with
libedit and international characters.

ここまで調査できたので、あとは Ruby の Readline ライブラリをデバッグしよう。