Skip to content

Commit 4cade4b

Browse files
committed
Add East Asian Ambiguous Width to irb_info command
1 parent 09c8db2 commit 4cade4b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/irb/cmd/info.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def inspect
1616
str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n"
1717
str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty?
1818
str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty?
19+
str += "East Asian Ambiguous Width: #{Reline.ambiguous_width.inspect}\n"
1920
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
2021
codepage = `chcp`.sub(/.*: (\d+)\n/, '\1')
2122
str += "Code page: #{codepage}\n"

test/irb/test_cmd.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def test_irb_info_multiline
8181
InputMethod:\sAbstract\sInputMethod\n
8282
\.irbrc\spath:\s.+\n
8383
RUBY_PLATFORM:\s.+\n
84+
East\sAsian\sAmbiguous\sWidth:\s\d\n
8485
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
8586
}x
8687
assert_match expected, irb.context.main.irb_info.to_s
@@ -107,6 +108,7 @@ def test_irb_info_singleline
107108
InputMethod:\sAbstract\sInputMethod\n
108109
\.irbrc\spath:\s.+\n
109110
RUBY_PLATFORM:\s.+\n
111+
East\sAsian\sAmbiguous\sWidth:\s\d\n
110112
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
111113
}x
112114
assert_match expected, irb.context.main.irb_info.to_s
@@ -135,6 +137,7 @@ def test_irb_info_multiline_without_rc_files
135137
IRB\sversion:\sirb\s.+\n
136138
InputMethod:\sAbstract\sInputMethod\n
137139
RUBY_PLATFORM:\s.+\n
140+
East\sAsian\sAmbiguous\sWidth:\s\d\n
138141
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
139142
\z
140143
}x
@@ -167,6 +170,7 @@ def test_irb_info_singleline_without_rc_files
167170
IRB\sversion:\sirb\s.+\n
168171
InputMethod:\sAbstract\sInputMethod\n
169172
RUBY_PLATFORM:\s.+\n
173+
East\sAsian\sAmbiguous\sWidth:\s\d\n
170174
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
171175
\z
172176
}x
@@ -201,6 +205,7 @@ def test_irb_info_lang
201205
RUBY_PLATFORM: .+\n
202206
LANG\senv:\sja_JP\.UTF-8\n
203207
LC_ALL\s env:\sen_US\.UTF-8\n
208+
East\sAsian\sAmbiguous\sWidth:\s\d\n
204209
}x
205210
assert_match expected, irb.context.main.irb_info.to_s
206211
ensure

0 commit comments

Comments
 (0)