From 2bb8293dfddc263859bf8a0b958bec722767e8df Mon Sep 17 00:00:00 2001 From: Marco Scholl Date: Wed, 27 Apr 2011 06:55:29 -0700 Subject: [PATCH 1/2] fix: checklist if nothing select --- lib/rdialog.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rdialog.rb b/lib/rdialog.rb index 5b2b221..3350ff6 100644 --- a/lib/rdialog.rb +++ b/lib/rdialog.rb @@ -1,4 +1,3 @@ - # vim:ts=4:sw=4: # = rdialog - A dialog gem for Ruby # @@ -168,7 +167,7 @@ def checklist(text, items, height=0, width=0, listheight=0) puts command success = system(command) puts success - if success + if success && tmp.size > 0 selected_string = tmp.readline tmp.close! selected_string.slice!(0) From cb750526362bcd6acdc35dbc439cd0ed24a9cd4d Mon Sep 17 00:00:00 2001 From: Marco Scholl Date: Wed, 27 Apr 2011 06:57:25 -0700 Subject: [PATCH 2/2] fix: yesno --- lib/rdialog.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/rdialog.rb b/lib/rdialog.rb index 3350ff6..aa4430b 100644 --- a/lib/rdialog.rb +++ b/lib/rdialog.rb @@ -510,11 +510,14 @@ def inputbox(text="Please enter some text", height=0, width=0, init="") # box has a Yes button and a No button, in which the user can # switch between by pressing the TAB key. - def yesno(text="Please enter some text", height=0, width=0) - command = option_string() + "--inputbox \"" + text.to_s + + def yesno(text="Please enter some text", height=0, width=0, value=true) + x = self.nocancel + self.nocancel = false + command = option_string() + (value ? "--yesno" : "--defaultno --yesno") + " \"" + text.to_s + "\" " + height.to_i.to_s + " " + width.to_i.to_s success = system(command) + self.nocancel = x return success end