[ruby/io-console] Fix removing unexpected control chars

`cc` is created as `"\C-x"`, it is a String since ruby 1.9.

65c9266feb
This commit is contained in:
Nobuyoshi Nakada 2025-07-01 17:24:02 +09:00 committed by git
parent 06f9fc20ec
commit d3d249b904

View file

@ -373,10 +373,10 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
w.flush
result = EnvUtil.timeout(3) {r.gets}
if result
case cc
when 0..31
case cc.chr
when "\C-A".."\C-_"
cc = "^" + (cc.ord | 0x40).chr
when 127
when "\C-?"
cc = "^?"
end
result.sub!(cc, "")