diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rwxr-xr-x | tool/redmine-backporter.rb | 29 |
2 files changed, 33 insertions, 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. 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 |