mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[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:
parent
06f9fc20ec
commit
d3d249b904
1 changed files with 3 additions and 3 deletions
|
@ -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, "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue