From richcalaway at revolution-computing.com  Wed Jul 29 23:20:41 2009
From: richcalaway at revolution-computing.com (Richard Calaway)
Date: Wed, 29 Jul 2009 14:20:41 -0700
Subject: [Rd] Problem in setRepositories() logic
Message-ID: <E6242E43-C389-43CB-9B9B-76EC327B55D5@revolution-computing.com>

Hi, all--

I was playing around with the Packages menu in the Windows RGui, and  
noticed that when I chose Select  repositories and clicked Cancel,  
instead of being returned to the R prompt I was faced with a text  
version of the menu. I think the text menu should only appear
if graphics=FALSE, and should explicitly say how to cancel, as well.  
The following changes make that happen:

Index: packages.R
===================================================================
--- packages.R  (revision 49021)
+++ packages.R  (working copy)
@@ -654,7 +654,7 @@
                                                     multiple = TRUE,  
"Repositories"),
                               a[, 1L])
          }
-        if(!length(res)) {
+        else {
              ## text-mode fallback
              cat(gettext("--- Please select repositories for use in  
this session ---\n"))
              nc <- length(default)
@@ -662,12 +662,12 @@
                            ifelse(default, "+", " "), " ", a[, 1L],
                            sep=""),
                  "", sep="\n")
-            cat(gettext("Enter one or more numbers separated by spaces 
\n"))
+            cat(gettext("Enter one or more numbers separated by  
spaces, or 0 to cancel\n"))
              res <- scan("", what=0, quiet=TRUE, nlines=1L)
-            if(!length(res) || (length(res) == 1L && !res[1L]))
-                return(invisible())
-            res <- res[1 <= res && res <= nc]
          }
+        if(!length(res) || (length(res) == 1L && !res[1L]))
+            return(invisible())
+        res <- res[1 <= res && res <= nc]
      }
      if(length(res)) {
          repos <- a[["URL"]]


Rich Calaway
Documentation Manager
REvolution Computing, Inc.
richcalaway at revolution-computing.com
206-577-4778 x3204



[Rd] Problem in setRepositories() logic
Richard Calaway