diff --git a/R/pr.R b/R/pr.R index 6b1c20dad..e1c2ca493 100644 --- a/R/pr.R +++ b/R/pr.R @@ -322,7 +322,7 @@ pr_fetch <- function(number = NULL, target = c("source", "primary")) { pr_user <- glue("@{pr$pr_user}") ui_bullets(c( "v" = "Checking out PR {.href [{pr$pr_string}]({pr$pr_html_url})} ({.field {pr_user}}): - {.val {pr$pr_title}}." + {.val {ui_escape_glue(pr$pr_title)}}." )) if (pr$pr_from_fork && isFALSE(pr$maintainer_can_modify)) { @@ -944,7 +944,7 @@ choose_branch <- function(exclude = character()) { ) at_user <- glue("@{pr_user}") template <- ui_pre_glue( - "{pretty_name} {cli::symbol$arrow_right} <> ({.field <>}): {.val <>}" + "{pretty_name} {cli::symbol$arrow_right} <> ({.field <>}): {.val <>}" ) cli::format_inline(template) } @@ -988,14 +988,15 @@ choose_pr <- function(tr = NULL, pr_dat = NULL) { function(pr_number, pr_html_url, pr_user, pr_state, pr_title) { href_number <- ui_pre_glue("{.href [PR #<>](<>)}") at_user <- glue("@{pr_user}") + pr_title_escaped <- ui_escape_glue(pr_title) if (some_closed) { template <- ui_pre_glue( - "<> ({.field <>}, {pr_state}): {.val <>}" + "<> ({.field <>}, {pr_state}): {.val <>}" ) cli::format_inline(template) } else { template <- ui_pre_glue( - "<> ({.field <>}): {.val <>}" + "<> ({.field <>}): {.val <>}" ) cli::format_inline(template) } diff --git a/R/utils-ui.R b/R/utils-ui.R index 98e3c86e3..125e064cc 100644 --- a/R/utils-ui.R +++ b/R/utils-ui.R @@ -162,6 +162,11 @@ ui_pre_glue <- function(..., .envir = parent.frame()) { glue(..., .open = "<<", .close = ">>", .envir = .envir) } +ui_escape_glue <- function(x) { + gsub("([{}])", "\\1\\1", x) +} + + bulletize <- function(x, bullet = "*", n_show = 5, n_fudge = 2) { n <- length(x) n_show_actual <- compute_n_show(n, n_show, n_fudge)