diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-19 09:21:38 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-19 09:21:38 +0000 |
commit | 0c92a85e6ab61e5b20b7ba5a60121302a791725d (patch) | |
tree | e96d7b3f58338e7a0e2f51f6a570d2e649a3a23b /ext/readline/readline.c | |
parent | 058888bd38fb6ff3f32423390e0d62732f79e5a6 (diff) | |
download | ruby-0c92a85e6ab61e5b20b7ba5a60121302a791725d.tar.gz |
* ext/readline/readline.c: add new methods:
Readline::completion_append_character and
Readline::completion_append_character=.k
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline/readline.c')
-rw-r--r-- | ext/readline/readline.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index c8ed81ac51..6482f942b4 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -167,6 +167,36 @@ readline_s_emacs_editing_mode(self) } static VALUE +readline_s_set_completion_append_character(self, str) + VALUE self, str; +{ + if (NIL_P(str)) { + rl_completion_append_character = '\0'; + } else { + StringValue(str); + + rl_completion_append_character = RSTRING(str)->ptr[0]; + } + + return self; +} + +static VALUE +readline_s_get_completion_append_character(self) + VALUE self; +{ + VALUE str; + + if (rl_completion_append_character == '\0') + return Qnil; + + str = rb_str_new("", 1); + RSTRING(str)->ptr[0] = rl_completion_append_character; + + return str; +} + +static VALUE hist_to_s(self) VALUE self; { @@ -395,6 +425,10 @@ Init_readline() readline_s_vi_editing_mode, 0); rb_define_singleton_method(mReadline, "emacs_editing_mode", readline_s_emacs_editing_mode, 0); + rb_define_singleton_method(mReadline, "completion_append_character=", + readline_s_set_completion_append_character, 1); + rb_define_singleton_method(mReadline, "completion_append_character", + readline_s_get_completion_append_character, 0); histary = rb_obj_alloc(rb_cObject); rb_extend_object(histary, rb_mEnumerable); |