ruby-changes:70349
From: aycabta <ko1@a...>
Date: Mon, 20 Dec 2021 16:19:47 +0900 (JST)
Subject: [ruby-changes:70349] b96ef7684c (master): [ruby/irb] Add East Asian Ambiguous Width to irb_info command
https://git.ruby-lang.org/ruby.git/commit/?id=b96ef7684c From b96ef7684c45ea1959c6f2bdad125b4a073419a4 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 20 Dec 2021 16:06:12 +0900 Subject: [ruby/irb] Add East Asian Ambiguous Width to irb_info command https://github.com/ruby/irb/commit/4cade4b7e5 --- lib/irb/cmd/info.rb | 1 + test/irb/test_cmd.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/irb/cmd/info.rb b/lib/irb/cmd/info.rb index 8ad0c2a438c..a2f2a27cecf 100644 --- a/lib/irb/cmd/info.rb +++ b/lib/irb/cmd/info.rb @@ -16,6 +16,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/cmd/info.rb#L16 str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n" str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty? str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty? + str += "East Asian Ambiguous Width: #{Reline.ambiguous_width.inspect}\n" if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ codepage = `chcp`.sub(/.*: (\d+)\n/, '\1') str += "Code page: #{codepage}\n" diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 8eee36badc6..07c0acfe6d2 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -81,6 +81,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L81 InputMethod:\sAbstract\sInputMethod\n \.irbrc\spath:\s.+\n RUBY_PLATFORM:\s.+\n + East\sAsian\sAmbiguous\sWidth:\s\d\n #{@is_win ? 'Code\spage:\s\d+\n' : ''} }x assert_match expected, irb.context.main.irb_info.to_s @@ -107,6 +108,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L108 InputMethod:\sAbstract\sInputMethod\n \.irbrc\spath:\s.+\n RUBY_PLATFORM:\s.+\n + East\sAsian\sAmbiguous\sWidth:\s\d\n #{@is_win ? 'Code\spage:\s\d+\n' : ''} }x assert_match expected, irb.context.main.irb_info.to_s @@ -135,6 +137,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L137 IRB\sversion:\sirb\s.+\n InputMethod:\sAbstract\sInputMethod\n RUBY_PLATFORM:\s.+\n + East\sAsian\sAmbiguous\sWidth:\s\d\n #{@is_win ? 'Code\spage:\s\d+\n' : ''} \z }x @@ -167,6 +170,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L170 IRB\sversion:\sirb\s.+\n InputMethod:\sAbstract\sInputMethod\n RUBY_PLATFORM:\s.+\n + East\sAsian\sAmbiguous\sWidth:\s\d\n #{@is_win ? 'Code\spage:\s\d+\n' : ''} \z }x @@ -201,6 +205,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L205 RUBY_PLATFORM: .+\n LANG\senv:\sja_JP\.UTF-8\n LC_ALL\s env:\sen_US\.UTF-8\n + East\sAsian\sAmbiguous\sWidth:\s\d\n }x assert_match expected, irb.context.main.irb_info.to_s ensure -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/