diff --git a/NAMESPACE b/NAMESPACE index 471963e14..9e63002d1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -160,7 +160,7 @@ export(type_sum) import(lifecycle) import(rlang) importFrom(cli,symbol) -importFrom(fansi,strip_sgr) +importFrom(fansi,strip_ctl) importFrom(fansi,substr2_ctl) importFrom(glue,as_glue) importFrom(utf8,utf8_width) diff --git a/R/extent.R b/R/extent.R index e6956dce2..9d0a9ea23 100644 --- a/R/extent.R +++ b/R/extent.R @@ -5,14 +5,14 @@ #' #' @param x A character vector. #' @export -#' @importFrom fansi strip_sgr +#' @importFrom fansi strip_ctl #' @importFrom utf8 utf8_width #' @examples #' get_extent(c("abc", "de")) #' get_extent("\u904b\u6c23") get_extent <- function(x) { force(x) - x <- strip_sgr(x, warn = FALSE) + x <- strip_ctl(x, warn = FALSE) width <- utf8_width(x, encode = FALSE, utf8 = TRUE) if (anyNA(width)) { is_na <- which(is.na(width)) diff --git a/R/ggplot2.R b/R/ggplot2.R index e32401fe4..87efcb11b 100644 --- a/R/ggplot2.R +++ b/R/ggplot2.R @@ -63,7 +63,7 @@ MakeScaleContinuousPositionNum <- function() { }, get_labels = function(self, breaks = self$get_breaks()) { out <- ggplot2::ggproto_parent(ggplot2::ScaleContinuousPosition, self)$get_labels(breaks) - fansi::strip_sgr(out) + fansi::strip_ctl(out) }, make_title = function(self, title) { out <- ggplot2::ggproto_parent(ggplot2::ScaleContinuousPosition, self)$make_title(title) diff --git a/R/utils.R b/R/utils.R index dcc02136b..33c487894 100644 --- a/R/utils.R +++ b/R/utils.R @@ -17,7 +17,7 @@ cat_line <- function(...) { } #' @importFrom utf8 utf8_width -#' @importFrom fansi strip_sgr substr2_ctl +#' @importFrom fansi strip_ctl substr2_ctl str_trunc <- function(x, width, shorten = NULL) { if (all(is.infinite(width))) { return(x) diff --git a/R/vctr.R b/R/vctr.R index 6a11b79b0..0da6b6783 100644 --- a/R/vctr.R +++ b/R/vctr.R @@ -45,7 +45,7 @@ obj_print_data.pillar_vctr <- function(x, ..., .size) { } # FIXME: base::print.default() can't use color, roll own implementation? - out <- stats::setNames(strip_sgr(format(x), warn = FALSE), names(x)) + out <- stats::setNames(strip_ctl(format(x), warn = FALSE), names(x)) print(out, quote = FALSE, max = vec_size(x)) invisible(x) }