Skip to content

Commit

Permalink
Use force() for better profiler output, r-prof/jointprof#34
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jul 4, 2018
1 parent 7e2a250 commit 22046dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions R/extent.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#' get_extent(c("abc", "de"))
#' get_extent("\u904b\u6c23")
get_extent <- function(x) {
force(x)
x <- fansi::strip_sgr(x, warn = FALSE)
width <- utf8::utf8_width(x, encode = FALSE, utf8 = TRUE)
is_na <- which(is.na(width))
Expand Down
2 changes: 2 additions & 0 deletions R/styles.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ keep_empty <- function(fun) {
#' @examples
#' style_subtle("text")
style_subtle <- keep_empty(function(x) {
force(x)
if (isTRUE(getOption("pillar.subtle", TRUE))) {
style_grey(0.6, x)
} else {
Expand All @@ -44,6 +45,7 @@ style_subtle_num <- function(x, negative) {
}

style_hint <- keep_empty(function(x) {
force(x)
if (isTRUE(getOption("pillar.subtle", TRUE))) {
style_grey(0.8, x)
} else {
Expand Down
4 changes: 3 additions & 1 deletion R/type.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
MIN_PILLAR_WIDTH <- 5L

style_type <- function(x) {
crayon::italic(style_subtle(x))
force(x)
x <- style_subtle(x)
crayon::italic(x)
}

#' Prepare a column type for formatting
Expand Down

0 comments on commit 22046dd

Please sign in to comment.