Skip to content

Commit

Permalink
Use ansi_nchar() to compute widths (#1609)
Browse files Browse the repository at this point in the history
Part of #1607
  • Loading branch information
hadley authored Apr 25, 2022
1 parent 7307b47 commit 0e03c40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/reporter-progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,14 @@ issue_header <- function(x, pad = FALSE) {
issue_summary <- function(x, rule = FALSE, simplify = "branch") {
header <- crayon::bold(issue_header(x))
if (rule) {
header <- cli::rule(header, width = max(nchar(header) + 6, 80))
header <- cli::rule(header, width = max(cli::ansi_nchar(header) + 6, 80))
}

paste0(header, "\n", format(x, simplify = simplify))
}

strpad <- function(x, width = cli::console_width()) {
n <- pmax(0, width - crayon::col_nchar(x))
n <- pmax(0, width - cli::ansi_nchar(x))
paste0(x, strrep(" ", n))
}

Expand Down

0 comments on commit 0e03c40

Please sign in to comment.