From 4038d916aee45dd0400d8e17de6615e938da8108 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Fri, 28 Jun 2019 09:00:33 -0400 Subject: [PATCH] Clarify prompt text in try_rsthemes() for #3 Restore current theme on exit if user cycles through all themes Prompt after all themes, including last --- R/rsthemes.R | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/R/rsthemes.R b/R/rsthemes.R index 716d578..4a06963 100644 --- a/R/rsthemes.R +++ b/R/rsthemes.R @@ -124,16 +124,18 @@ try_rsthemes <- function( rstudioapi::applyTheme(theme) if (delay > 0) { Sys.sleep(delay) - } else if (theme != themes[length(themes)]) { - res <- readline("Press [enter] for next, [k] to keep, [q] to quit...") - if (tolower(res) == "k") return(invisible()) - if (tolower(res) == "q") { - message("Restoring \"", current_theme$editor, "\"") - rstudioapi::applyTheme(current_theme$editor) - return(invisible()) + } else { + if (theme != themes[length(themes)]) { + res <- readline("Enter [blank] for next, [k] to keep, [q] to quit: ") + } else { + res <- readline("Enter [blank] or [q] to quit, [k] to keep: ") } + if (tolower(res) == "k") return(invisible()) + if (tolower(res) == "q") break } } + message("Restoring \"", current_theme$editor, "\"") + rstudioapi::applyTheme(current_theme$editor) } #' @describeIn rsthemes List style options