From b96ef7684c45ea1959c6f2bdad125b4a073419a4 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 20 Dec 2021 16:06:12 +0900 Subject: [PATCH] [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 8ad0c2a438..a2f2a27cec 100644 --- a/lib/irb/cmd/info.rb +++ b/lib/irb/cmd/info.rb @@ -16,6 +16,7 @@ module IRB 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 8eee36badc..07c0acfe6d 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -81,6 +81,7 @@ module TestIRB 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 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 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 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 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