зеркало из https://github.com/github/ruby.git
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:
Родитель
2076f1e009
Коммит
6cb0b95fe3
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче