summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-20 02:25:48 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-20 02:25:48 +0000
commit5a314fbccc0b8a3cbcfcf9baa912d19adee6377d (patch)
tree40550da358bbee5bfdf321a2b008c9a70f3ba6de /tool
parent62ef3835238e733f9faaef121730d81caf254990 (diff)
* 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
Diffstat (limited to 'tool')
-rwxr-xr-xtool/redmine-backporter.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index 918584a904..847c243c64 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -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