diff --git a/NEWS.md b/NEWS.md index 0e55b4e..e755444 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # Version (development version) +* `handler_cli()` no longer forces a display update after every + tick, instead relying on cli itself to decide how often to + refresh the display. This results in much better performance. + + ## Deprecated and Defunct * Remove `progress()`, which has been defunct since **progressr** diff --git a/R/handler_cli.R b/R/handler_cli.R index 9fd3395..f0f3e38 100644 --- a/R/handler_cli.R +++ b/R/handler_cli.R @@ -84,10 +84,10 @@ handler_cli <- function(show_after = 0.0, intrusiveness = getOption("progressr.i cli_progress_call(cli::cli_progress_bar, total = total, ...) } - cli_progress_update <- function(id, ..., force = TRUE, .envir) { + cli_progress_update <- function(id, ..., .envir) { ## WORKAROUND: Do not involve 'cli' when total = 0 if (.envir$total == 0) return(id) - cli_progress_call(cli::cli_progress_update, id = id, ..., force = force, .envir = .envir) + cli_progress_call(cli::cli_progress_update, id = id, ..., .envir = .envir) } cli_progress_done <- function(id, ..., .envir) { @@ -116,7 +116,7 @@ handler_cli <- function(show_after = 0.0, intrusiveness = getOption("progressr.i } } else { cli_progress_bar <- function(total, ...) "id-dummy" - cli_progress_update <- function(id, ..., force = TRUE, .envir) "id-dummy" + cli_progress_update <- function(id, ..., .envir) "id-dummy" cli_progress_done <- function(id, ..., .envir) "id-dummy" erase_progress_bar <- function(pb) NULL redraw_progress_bar <- function(pb) NULL