1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

redmine-backporter.rb: improve mygets

* tool/redmine-backporter.rb (mygets): newline to finish, fix DEL
  code, erase the last character at DEL/BS, and use \C escapes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-20 03:09:56 +00:00
parent 2076f1e009
commit 6cb0b95fe3

View file

@ -202,17 +202,16 @@ def mygets
line = ''
while 1
case c = console.getch
when "\r"
when "\r", "\n"
puts
line << c
return line
when "\x07", "\b" # DEL/BS
print "\b"
line.chop!
when "\x15" # C-u
when "\C-?", "\b" # DEL/BS
print "\b \b" if line.chop!
when "\C-u"
print cls
line.clear
when "\x04" # C-d
when "\C-d"
return nil if line.empty?
line << c
else