mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* tool/redmine-backporter.rb (mygets): to support Backspace
implement gets by itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
62ef383523
commit
5a314fbccc
2 changed files with 33 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Jan 20 11:23:47 2015 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* tool/redmine-backporter.rb (mygets): to support Backspace
|
||||
implement gets by itself.
|
||||
|
||||
Tue Jan 20 02:54:11 2015 Zachary Scott <e@zzak.io>
|
||||
|
||||
* file.c: NotImplementedError is raised if birthtime is unavailable.
|
||||
|
|
|
@ -195,6 +195,33 @@ def more(sio)
|
|||
end
|
||||
end
|
||||
|
||||
def mygets
|
||||
console = IO.console
|
||||
ly, lx = console.winsize
|
||||
cls = "\r" + (" " * lx) + "\r> "
|
||||
line = ''
|
||||
while 1
|
||||
case c = console.getch
|
||||
when "\r"
|
||||
puts
|
||||
line << c
|
||||
return line
|
||||
when "\x07", "\b" # DEL/BS
|
||||
print "\b"
|
||||
line.chop!
|
||||
when "\x15" # C-u
|
||||
print cls
|
||||
line.clear
|
||||
when "\x04" # C-d
|
||||
return nil if line.empty?
|
||||
line << c
|
||||
else
|
||||
print c
|
||||
line << c
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def mergeinfo
|
||||
`svn propget svn:mergeinfo #{RUBY_REPO_PATH}`
|
||||
end
|
||||
|
@ -234,7 +261,7 @@ puts "Backporter #{VERSION}".color(bold: true) + " for #{TARGET_VERSION}"
|
|||
while true
|
||||
print '> '
|
||||
begin
|
||||
l = gets
|
||||
l = mygets
|
||||
rescue Interrupt
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue