ruby-changes:9173
From: yugui <ko1@a...>
Date: Sat, 13 Dec 2008 10:59:39 +0900 (JST)
Subject: [ruby-changes:9173] Ruby:r20709 (ruby_1_9_1): merges r20680 and r20682 from trunk into ruby_1_9_1.
yugui 2008-12-13 10:59:19 +0900 (Sat, 13 Dec 2008) New Revision: 20709 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20709 Log: merges r20680 and r20682 from trunk into ruby_1_9_1. * ext/readline/readline.c (readline_s_get_completion_append_character): uses locale encoding but not ASCII-8BIT. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/ext/readline/readline.c branches/ruby_1_9_1/test/readline/test_readline.rb Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20708) +++ ruby_1_9_1/ChangeLog (revision 20709) @@ -1,3 +1,9 @@ +Sat Dec 13 01:10:03 2008 TAKAO Kouji <kouji@t...> + + * ext/readline/readline.c + (readline_s_get_completion_append_character): uses locale + encoding but not ASCII-8BIT. + Fri Dec 12 19:24:47 2008 Yuki Sonoda (Yugui) <yugui@y...> * common.mk (run, runruby, parse, gdb, gdb-ruby): you can also run Index: ruby_1_9_1/ext/readline/readline.c =================================================================== --- ruby_1_9_1/ext/readline/readline.c (revision 20708) +++ ruby_1_9_1/ext/readline/readline.c (revision 20709) @@ -602,15 +602,14 @@ readline_s_get_completion_append_character(VALUE self) { #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER - VALUE str; + char buf[1]; rb_secure(4); if (rl_completion_append_character == '\0') return Qnil; - str = rb_str_new(0, 1); - RSTRING_PTR(str)[0] = rl_completion_append_character; - return str; + buf[0] = (char) rl_completion_append_character; + return rb_locale_str_new(buf, 1); #else rb_notimplement(); return Qnil; /* not reached */ Index: ruby_1_9_1/test/readline/test_readline.rb =================================================================== --- ruby_1_9_1/test/readline/test_readline.rb (revision 20708) +++ ruby_1_9_1/test/readline/test_readline.rb (revision 20709) @@ -166,12 +166,18 @@ def test_completion_append_character begin - Readline.completion_append_character = "x" - assert_equal("x", Readline.completion_append_character) - Readline.completion_append_character = "xyz" - assert_equal("x", Readline.completion_append_character) - Readline.completion_append_character = nil - assert_equal(nil, Readline.completion_append_character) + enc = Encoding.default_internal || Encoding.find("locale") + data_expected = [ + ["x", "x"], + ["xyx", "x"], + [" ", " "], + ["\t", "\t"], + ] + data_expected.each do |(data, expected)| + Readline.completion_append_character = data + assert_equal(expected, Readline.completion_append_character) + assert_equal(enc, Readline.completion_append_character.encoding) + end Readline.completion_append_character = "" assert_equal(nil, Readline.completion_append_character) rescue NotImplementedError -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/