R Under development (unstable) (2023-12-07 r85661 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # to avoid variability on terminals with different capabilities > # plus generally random options being set > > if(getRversion() < "3.2.2") { + warning("Cannot run tests with R version less than 3.2.2.") + } else if(!suppressWarnings(require('fansi'))) { + # this is to avoid accidentally running tests under valgrind without fansi + # installed... (no, we've never done this...) + warning("Cannot run tests without package `fansi`") + } else if(!suppressWarnings(require('unitizer'))) { + warning("Cannot run tests without package `unitizer`") + } else { + old.opt <- options( + fansi.tabs.as.spaces=FALSE, + fansi.tab.stops=8L, + fansi.warn=TRUE, + fansi.term.cap=c('bright', '256') + # warnPartialMatchArgs = TRUE, + # warnPartialMatchAttr = TRUE, + # warnPartialMatchDollar = TRUE + ) + on.exit(old.opt) + pat.all <- "^[^.].*\\.[Rr]$" + pattern <- pat.all + # pattern <- "over" + unitize_dir( + 'unitizer', + pattern=pattern, + state='suggested' + ) + # we skip utf8 tests on solaris due to the problems with deparse (and maybe + # others, don't have a solaris system handy for testing). + if( + !grepl("solaris|sun", Sys.info()[['sysname']], ignore.case=TRUE) && + identical(pattern, pat.all) + ) { + unitize('special/utf8.R', state='suggested') + } + # UCD 12.1 update in 4.0.4 produces correct widths for emoji + if(getRversion() >= "4.0.4" && identical(pattern, pat.all)) + unitize('special/emo-graph.R', state='suggested') + } Loading required package: fansi Loading required package: unitizer State tracking is disabled by default to comply with CRAN policies. Add `options(unitizer.state='suggested')` to your 'Rprofile' file to enable, or `options(unitizer.state='off')` to quash this message without enabling. Prior to enabling, be sure to read `?unitizerState`,in particular the 'CRAN non-compliance' section. Preloads... Loading unitizer data... Parsing tests... Parsing unitizer/has.R Parsing unitizer/interactions.R Parsing unitizer/misc.R Parsing unitizer/nchar.R Parsing unitizer/normalize.R Parsing unitizer/overflow.R Parsing unitizer/strip.R Parsing unitizer/strsplit.R Parsing unitizer/substr.R Parsing unitizer/tabs.R Parsing unitizer/tohtml.R Parsing unitizer/trimws.R Parsing unitizer/url.R Parsing unitizer/wrap.R Evaluating tests... 1/14 has.R: 1/14 has.R: library(fansi) 1/14 has.R: unitizer_sect("has", { 1/14 has.R: has_ctl(paste0(red, "hello", end)) [1] TRUE 1/14 has.R: has_ctl(paste0("hello", end)) [1] TRUE 1/14 has.R: has_ctl(paste0("hello")) [1] FALSE 1/14 has.R: in.middle <- c("world", paste0("hello", red), "wow") 1/14 has.R: in.end <- c("world", "wow", paste0("hello", red)) 1/14 has.R: in.start <- c(paste0("hello", red), "wow", "world") 1/14 has.R: has_ctl(in.middle) [1] FALSE TRUE FALSE 1/14 has.R: has_ctl(in.end) [1] FALSE FALSE TRUE 1/14 has.R: has_ctl(in.start) [1] TRUE FALSE FALSE 1/14 has.R: has_ctl(c(in.start, NA)) [1] TRUE FALSE FALSE NA 1/14 has.R: has_ctl("hello\nworld") [1] TRUE 1/14 has.R: has_sgr("hello\nworld") [1] FALSE 1/14 has.R: has_sgr(in.end) [1] FALSE FALSE TRUE 1/14 has.R: has_ctl("hello\033p world") [1] TRUE 1/14 has.R: unitizer_sect("corner cases", { 1/14 has.R: has_ctl("hello\033[31#0mworld") [1] TRUE 1/14 has.R: suppressWarnings(has_ctl("hello\033[31#0mworld")) [1] TRUE 1/14 has.R: has_ctl("hello world", ctl = c("sgr", "sgr")) [1] FALSE 1/14 has.R: has_ctl("hello\033[31#0") Warning in has_ctl("hello\033[31#0") : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] TRUE 1/14 has.R: unitizer_sect("select ctl", { 1/14 has.R: has_ctl("hello\033[31mworld", ctl = c("sgr")) [1] TRUE 1/14 has.R: has_ctl("hello\033[31mworld", ctl = c("csi")) [1] FALSE 1/14 has.R: has_ctl("hello\033[31!mworld", ctl = c("sgr")) [1] TRUE 1/14 has.R: has_ctl("hello\033[31!mworld", ctl = c("csi")) [1] FALSE 1/14 has.R: has_ctl("hello\033[31lworld", ctl = c("csi")) [1] TRUE 1/14 has.R: has_ctl("hello\nworld", ctl = c("all", "nl")) [1] FALSE 1/14 has.R: has_ctl("hello\nworld", ctl = c("all", "c0")) [1] TRUE 1/14 has.R: has_ctl("hello\tworld", ctl = c("all", "c0")) [1] FALSE 1/14 has.R: has_ctl("hello\tworld", ctl = c("c0")) [1] TRUE 1/14 has.R: has_ctl("hello\033pworld", ctl = c("esc")) [1] TRUE 1/14 has.R: has_ctl("hello\033pworld", ctl = c("all", "esc")) [1] FALSE 1/14 has.R: unitizer_sect("bad inputs", { 1/14 has.R: has_ctl("hello world", warn = NULL) Error in has_ctl("hello world", warn = NULL) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> has_ctl -> VAL_IN_ENV -> stop2 1/14 has.R: has_ctl("hello world", ctl = 1:3) Error in has_ctl("hello world", ctl = 1:3) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> has_ctl -> VAL_IN_ENV -> stop2 1/14 has.R: has_ctl("hello world", ctl = "bananas") Error in has_ctl("hello world", ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> has_ctl -> VAL_IN_ENV -> stop2 1/14 has.R: has_ctl("hello world", ctl = NA_character_) Error in has_ctl("hello world", ctl = NA_character_) : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> has_ctl -> VAL_IN_ENV -> stop2 1/14 has.R: has_ctl(c("\033[31mhello", "wo\nrld"), ctl = character()) [1] FALSE FALSE 1/14 has.R: unitizer_sect("deprecation", { 1/14 has.R: has_ctl("hello world", which = "sgr") Parameter `which` has been deprecated; use `ctl` instead. [1] FALSE 2/14 interactions.R: 2/14 interactions.R: library(fansi) 2/14 interactions.R: unitizer_sect("substr", { 2/14 interactions.R: str.0 <- c("\033[44mhello", "world") 2/14 interactions.R: substr_ctl(str.0, 2, 4) [1] "\033[44mell\033[0m" "orl" 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = TRUE) [1] "\033[44mell\033[0m" "\033[44morl\033[0m" 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = "\033[33m") [1] "\033[33;44mell\033[0m" "\033[33;44morl\033[0m" 2/14 interactions.R: substr2_ctl(str.0, 2, 4, carry = "\033[33m") [1] "\033[33;44mell\033[0m" "\033[33;44morl\033[0m" 2/14 interactions.R: substr_sgr(str.0, 2, 4, carry = "\033[33m") [1] "\033[33;44mell\033[0m" "\033[33;44morl\033[0m" 2/14 interactions.R: substr2_sgr(str.0, 2, 4, carry = "\033[33m") [1] "\033[33;44mell\033[0m" "\033[33;44morl\033[0m" 2/14 interactions.R: str.1 <- c("hello", "\033[44mworld", "barrow") 2/14 interactions.R: substr_ctl(str.1, 2, 4) [1] "ell" "\033[44morl\033[0m" "arr" 2/14 interactions.R: substr_ctl(str.1, 2, 4, carry = TRUE) [1] "ell" "\033[44morl\033[0m" "\033[44marr\033[0m" 2/14 interactions.R: substr_ctl(str.1, 2, 4, carry = "\033[33m") [1] "\033[33mell\033[0m" "\033[33;44morl\033[0m" "\033[33;44marr\033[0m" 2/14 interactions.R: str.2 <- c("\033[33mA\033[44mBCD", "ABCD", "\033[39mABCD") 2/14 interactions.R: substr_ctl(str.2, 2, 2) [1] "\033[33;44mB\033[0m" "B" "B" 2/14 interactions.R: substr_ctl(str.2, 2, 2, carry = TRUE) [1] "\033[33;44mB\033[0m" "\033[33;44mB\033[0m" "\033[44mB\033[0m" 2/14 interactions.R: substr_ctl(str.2, 2, 2, carry = TRUE, terminate = FALSE) [1] "\033[33;44mB" "B" "\033[0;44mB" 2/14 interactions.R: str.3 <- c("\033[35mA\033[42mB", "\033[49mCD") 2/14 interactions.R: substr_ctl(str.3, 2, 2, carry = TRUE, terminate = FALSE) [1] "\033[35;42mB" "\033[0;35mD" 2/14 interactions.R: wrp.0 <- c("once upon \033[44ma time in a land far away ov 2/14 interactions.R: unitizer_sect("wrap/trim", { 2/14 interactions.R: strwrap_ctl(wrp.0, 20) [1] "once upon \033[44ma time in\033[0m" "\033[44ma land far away\033[0m" [3] "\033[44mover\033[0m" "the mountains and" [5] "\033[7msea lived a fair\033[0m" "\033[7mcreature\033[0m" [7] "with \033[4mdark itentions\033[0m" "\033[4mand a yappy dog.\033[0m" 2/14 interactions.R: strwrap_ctl(wrp.0, 20, carry = TRUE) [1] "once upon \033[44ma time in\033[0m" [2] "\033[44ma land far away\033[0m" [3] "\033[44mover\033[0m" [4] "\033[44mthe mountains and\033[0m" [5] "\033[7;44msea lived a fair\033[0m" [6] "\033[7;44mcreature\033[0m" [7] "\033[7;44mwith \033[4mdark itentions\033[0m" [8] "\033[4;7;44mand a yappy dog.\033[0m" 2/14 interactions.R: strwrap_ctl(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in\033[0m" [2] "\033[33;44ma land far away\033[0m" [3] "\033[33;44mover\033[0m" [4] "\033[33;44mthe mountains and\033[0m" [5] "\033[7;33;44msea lived a fair\033[0m" [6] "\033[7;33;44mcreature\033[0m" [7] "\033[7;33;44mwith \033[4mdark itentions\033[0m" [8] "\033[4;7;33;44mand a yappy dog.\033[0m" 2/14 interactions.R: strwrap_sgr(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in\033[0m" [2] "\033[33;44ma land far away\033[0m" [3] "\033[33;44mover\033[0m" [4] "\033[33;44mthe mountains and\033[0m" [5] "\033[7;33;44msea lived a fair\033[0m" [6] "\033[7;33;44mcreature\033[0m" [7] "\033[7;33;44mwith \033[4mdark itentions\033[0m" [8] "\033[4;7;33;44mand a yappy dog.\033[0m" 2/14 interactions.R: strwrap2_ctl(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in\033[0m" [2] "\033[33;44ma land far away\033[0m" [3] "\033[33;44mover\033[0m" [4] "\033[33;44mthe mountains and\033[0m" [5] "\033[7;33;44msea lived a fair\033[0m" [6] "\033[7;33;44mcreature\033[0m" [7] "\033[7;33;44mwith \033[4mdark itentions\033[0m" [8] "\033[4;7;33;44mand a yappy dog.\033[0m" 2/14 interactions.R: strwrap2_sgr(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in\033[0m" [2] "\033[33;44ma land far away\033[0m" [3] "\033[33;44mover\033[0m" [4] "\033[33;44mthe mountains and\033[0m" [5] "\033[7;33;44msea lived a fair\033[0m" [6] "\033[7;33;44mcreature\033[0m" [7] "\033[7;33;44mwith \033[4mdark itentions\033[0m" [8] "\033[4;7;33;44mand a yappy dog.\033[0m" 2/14 interactions.R: strtrim_ctl(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in \033[0m" [2] "\033[33;44mthe mountains and \033[7m s\033[0m" [3] "\033[7;33;44mwith \033[4mdark itentions \033[0m" 2/14 interactions.R: strtrim_sgr(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in \033[0m" [2] "\033[33;44mthe mountains and \033[7m s\033[0m" [3] "\033[7;33;44mwith \033[4mdark itentions \033[0m" 2/14 interactions.R: strtrim2_ctl(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in \033[0m" [2] "\033[33;44mthe mountains and \033[7m s\033[0m" [3] "\033[7;33;44mwith \033[4mdark itentions \033[0m" 2/14 interactions.R: strtrim2_sgr(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in \033[0m" [2] "\033[33;44mthe mountains and \033[7m s\033[0m" [3] "\033[7;33;44mwith \033[4mdark itentions \033[0m" 2/14 interactions.R: wrp.1 <- c("once upon \033[44ma time in a land far away ov 2/14 interactions.R: strtrim_ctl(wrp.0, 20, carry = "\033[33m") [1] "\033[33monce upon \033[44ma time in \033[0m" [2] "\033[33;44mthe mountains and \033[7m s\033[0m" [3] "\033[7;33;44mwith \033[4mdark itentions \033[0m" 2/14 interactions.R: wrp.2 <- c("hello \033[42mworld", "goodnight\033[49m moon" 2/14 interactions.R: strwrap_ctl(wrp.2, 10, carry = "\033[35m", simplify = FALS [[1]] [1] "\033[35mhello\033[0m" "\033[35;42mworld\033[0m" [[2]] [1] "\033[35;42mgoodnight\033[0m" "\033[35mmoon\033[0m" [[3]] [1] "\033[35moh \033[39mboy" 2/14 interactions.R: strwrap_ctl(wrp.2, 10, carry = "\033[35m", simplify = FALS [[1]] [1] "hello" "\033[42mworld" [[2]] [1] "goodnight" "\033[0;35mmoon" [[3]] [1] "oh \033[39mboy" 2/14 interactions.R: unitizer_sect("normalize", { 2/14 interactions.R: str.2 <- c("\033[44mhello", "wo\033[mrld", "barrow") 2/14 interactions.R: normalize_state(str.2) [1] "\033[44mhello" "world" "barrow" 2/14 interactions.R: normalize_state(str.2, carry = TRUE) [1] "\033[44mhello" "wo\033[49mrld" "barrow" 2/14 interactions.R: normalize_state(str.2, carry = "\033[33m") [1] "\033[44mhello" "wo\033[39m\033[49mrld" "barrow" 2/14 interactions.R: unitizer_sect("carry corner cases", { 2/14 interactions.R: substr_ctl("", 2, 3, carry = "\033[33m") [1] "" 2/14 interactions.R: substr_ctl("", 2, 3, carry = "\033[33m", terminate = FALSE [1] "" 2/14 interactions.R: substr_ctl("\033[39m", 2, 3, carry = "\033[33m", terminate [1] "\033[0m" 2/14 interactions.R: substr_ctl("\033[39m", 2, 3, carry = "\033[33m", terminate [1] "\033[39m" 2/14 interactions.R: substr_ctl("", 0, 1, carry = "\033[33m") [1] "" 2/14 interactions.R: substr_ctl("", 0, 1, carry = "\033[33m", terminate = FALSE [1] "" 2/14 interactions.R: substr_ctl("\033[39m", 0, 1, carry = "\033[33m", terminate [1] "\033[0m" 2/14 interactions.R: substr_ctl("\033[39m", 0, 1, carry = "\033[33m", terminate [1] "\033[39m" 2/14 interactions.R: substr_ctl("", 0, 0, carry = "\033[33m") [1] "" 2/14 interactions.R: substr_ctl("", 0, 0, carry = "\033[33m", terminate = FALSE [1] "" 2/14 interactions.R: substr_ctl("\033[39m", 0, 0, carry = "\033[33m", terminate [1] "" 2/14 interactions.R: substr_ctl(character(), 2, 4, carry = "\033[33m") character(0) 2/14 interactions.R: substr_ctl(NA, 2, 4, carry = "\033[33m") [1] NA 2/14 interactions.R: substr_ctl(environment(), 2, 4, carry = "\033[33m") Error in as.character(args[["x"]]) : cannot coerce type 'environment' to vector of type 'character' Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV 2/14 interactions.R: substr_ctl("hello", 2, 4, carry = c("\033[33m", "\033[44m" Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `carry` must be scalar. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = NA_character_) Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `carry` may not be NA. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = character()) Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `carry` must be scalar. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = 1) Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `carry` must be logical or character. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: substr_ctl(str.0, 2, 4, carry = Inf) Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `carry` must be logical or character. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: sgrs <- c("A\033[31mB", "C\033[1mD", "E\033[4mF", "G\033[1 2/14 interactions.R: substr_ctl(sgrs, 2, 2, carry = TRUE) [1] "\033[31mB\033[0m" "\033[1;31mD\033[0m" [3] "\033[1;4;31mF\033[0m" "\033[1;4;31;13mH\033[0m" [5] "\033[1;4;31;62;13mJ\033[0m" "\033[1;4;62;13mL\033[0m" [7] "\033[1;4;52;62;13mN\033[0m" "\033[1;4;52;13mP\033[0m" [9] "\033[4;52;13mR\033[0m" "\033[52;13mT\033[0m" [11] "\033[13mU\033[0m" "W" 2/14 interactions.R: normalize_state(str.2, carry = NA_character_) Error in normalize_state(str.2, carry = NA_character_) : Argument `carry` may not be NA. Calls: unitize_dir ... withVisible -> normalize_state -> VAL_IN_ENV -> stop2 2/14 interactions.R: normalize_state(str.2, carry = character()) Error in normalize_state(str.2, carry = character()) : Argument `carry` must be scalar. Calls: unitize_dir ... withVisible -> normalize_state -> VAL_IN_ENV -> stop2 2/14 interactions.R: normalize_state(str.2, carry = 1) Error in normalize_state(str.2, carry = 1) : Argument `carry` must be logical or character. Calls: unitize_dir ... withVisible -> normalize_state -> VAL_IN_ENV -> stop2 2/14 interactions.R: normalize_state(str.2, carry = Inf) Error in normalize_state(str.2, carry = Inf) : Argument `carry` must be logical or character. Calls: unitize_dir ... withVisible -> normalize_state -> VAL_IN_ENV -> stop2 2/14 interactions.R: strwrap_ctl(wrp.0, 20, carry = NA_character_) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `carry` may not be NA. Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: strwrap_sgr(wrp.0, 20, carry = character()) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `carry` must be scalar. Calls: unitize_dir ... strwrap_sgr -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: strwrap2_ctl(wrp.0, 20, carry = 1) Error in strwrap2_ctl(wrp.0, 20, carry = 1) : Argument `carry` must be logical or character. Calls: unitize_dir ... eval -> withVisible -> strwrap2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: strwrap2_sgr(wrp.0, 20, carry = Inf) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `carry` must be logical or character. Calls: unitize_dir ... strwrap2_sgr -> strwrap2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: strwrap_ctl(c("\033[33mA \033[4mB", "\033[44mC D"), carry [1] "\033[33mA\033[0m" "\033[4;33mB\033[0m" "\033[4;33;44mC\033[0m" [4] "\033[4;33;44mD\033[0m" 2/14 interactions.R: unitizer_sect("terminate", { 2/14 interactions.R: str.0 <- c("hel\033[33m", "wo\033[44mrld") 2/14 interactions.R: substr_ctl(str.0, 2, 5, terminate = FALSE) [1] "el\033[33m" "o\033[44mrld" 2/14 interactions.R: substr_sgr(str.0, 2, 5, terminate = FALSE) [1] "el\033[33m" "o\033[44mrld" 2/14 interactions.R: substr2_ctl(str.0, 2, 5, terminate = FALSE) [1] "el\033[33m" "o\033[44mrld" 2/14 interactions.R: substr2_sgr(str.0, 2, 5, terminate = FALSE) [1] "el\033[33m" "o\033[44mrld" 2/14 interactions.R: strwrap_ctl(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in" "a land far away" [3] "over" "the mountains and" [5] "\033[7msea lived a fair" "creature" [7] "with \033[4mdark itentions" "and a yappy dog." 2/14 interactions.R: strwrap_sgr(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in" "a land far away" [3] "over" "the mountains and" [5] "\033[7msea lived a fair" "creature" [7] "with \033[4mdark itentions" "and a yappy dog." 2/14 interactions.R: strwrap2_ctl(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in" "a land far away" [3] "over" "the mountains and" [5] "\033[7msea lived a fair" "creature" [7] "with \033[4mdark itentions" "and a yappy dog." 2/14 interactions.R: strwrap2_sgr(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in" "a land far away" [3] "over" "the mountains and" [5] "\033[7msea lived a fair" "creature" [7] "with \033[4mdark itentions" "and a yappy dog." 2/14 interactions.R: strtrim_ctl(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in " "the mountains and \033[7m s" [3] "with \033[4mdark itentions " 2/14 interactions.R: strtrim_sgr(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in " "the mountains and \033[7m s" [3] "with \033[4mdark itentions " 2/14 interactions.R: strtrim2_ctl(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in " "the mountains and \033[7m s" [3] "with \033[4mdark itentions " 2/14 interactions.R: strtrim2_sgr(wrp.0, 20, terminate = FALSE) [1] "once upon \033[44ma time in " "the mountains and \033[7m s" [3] "with \033[4mdark itentions " 2/14 interactions.R: strtrim2_sgr(wrp.0, 20, terminate = NA) Error in strtrim2_ctl(x = x, width = width, warn = warn, tabs.as.spaces = tabs.as.spaces, : Argument `terminate` must be TRUE or FALSE Calls: unitize_dir ... strtrim2_sgr -> strtrim2_ctl -> VAL_IN_ENV -> stop2 2/14 interactions.R: unitizer_sect("bridge", { 2/14 interactions.R: fansi:::bridge("\033[42m", "\033[31m") [1] "\033[0;31m" 2/14 interactions.R: fansi:::bridge("\033[42m", "\033[31m", normalize = TRUE) [1] "\033[49m\033[31m" 2/14 interactions.R: fansi:::bridge("", "\033[31m") [1] "\033[31m" 2/14 interactions.R: fansi:::bridge("\033[42m", "") [1] "\033[0m" 2/14 interactions.R: fansi:::bridge("\033[42m", "\033[42m") [1] "" 2/14 interactions.R: end <- c("\033[31", "\033[41m", NA_character_, "\033[44m") 2/14 interactions.R: restart <- c("", NA_character_, "\033[45m", "\033[45m") 2/14 interactions.R: fansi:::bridge(end, restart) [1] "" "" "" "\033[45m" 2/14 interactions.R: base.st <- "%s\033]8;%s;%s\033\\" 2/14 interactions.R: url <- "https://x.yz" 2/14 interactions.R: u0 <- sprintf(base.st, "", "", url) 2/14 interactions.R: fansi:::bridge(paste0("\033[42m", u0), "\033[31m") [1] "\033[0;31m\033]8;;\033\\" 2/14 interactions.R: fansi:::bridge("\033[31m", paste0("\033[42m", u0)) [1] "\033[0;42m\033]8;;https://x.yz\033\\" 2/14 interactions.R: txt <- c("A\033[31mBC", "D\033[39mE\033[42mF") 2/14 interactions.R: `substr_ctl<-`(txt, 2, 2, value = "?", normalize = TRUE, c [1] "A?\033[31mC" "D\033[39m?\033[42mF" 2/14 interactions.R: unitizer_sect("at end / close", { 2/14 interactions.R: x <- c("a\033[31mb", "c", "\033[42md") 2/14 interactions.R: state_at_end(x) [1] "\033[31m" "" "\033[42m" 2/14 interactions.R: state_at_end(x, carry = TRUE) [1] "\033[31m" "\033[31m" "\033[31;42m" 2/14 interactions.R: state_at_end(x, carry = TRUE, normalize = TRUE) [1] "\033[31m" "\033[31m" "\033[31m\033[42m" 2/14 interactions.R: state_at_end("a\033[pb") Warning in state_at_end("a\033[pb") : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "" 2/14 interactions.R: state_at_end("a\033[pb", warn = FALSE) [1] "" 2/14 interactions.R: state_at_end(c("\033[42mA", NA_character_, "\033[31mA")) [1] "\033[42m" NA "\033[31m" 2/14 interactions.R: state_at_end(c("\033[42mA", NA_character_, "\033[31mA"), c [1] "\033[42m" NA NA 2/14 interactions.R: close_state(x) [1] "\033[0m" "" "\033[0m" 2/14 interactions.R: close_state(x, normalize = TRUE) [1] "\033[39m" "" "\033[49m" 2/14 interactions.R: close_state("a\033[pb") Warning in close_state("a\033[pb") : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "" 2/14 interactions.R: close_state("a\033[pb", warn = FALSE) [1] "" 2/14 interactions.R: state_no_arg <- function(x) { 2/14 interactions.R: x <- "\xf0" 2/14 interactions.R: Encoding(x) <- "UTF-8" 2/14 interactions.R: state_no_arg(x) [1] "Encountered a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`." 2/14 interactions.R: y <- "\033[45phello" 2/14 interactions.R: state_no_arg(y) [1] "Encountered a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 3/14 misc.R: 3/14 misc.R: library(unitizer) 3/14 misc.R: library(fansi) 3/14 misc.R: unitizer_sect("term_cap_test", { 3/14 misc.R: tct <- term_cap_test() bright  -> \033[91;104mbright \033[0m 256  -> \033[38;5;196;48;5;21m256 \033[0m truecolor -> \033[38;2;255;0;0;48;2;0;0;255mtruecolor\033[0m 3/14 misc.R: tct [1] "\033[91;104mbright \033[0m" [2] "\033[38;5;196;48;5;21m256 \033[0m" [3] "\033[38;2;255;0;0;48;2;0;0;255mtruecolor\033[0m" 3/14 misc.R: fansi_lines(LETTERS, step = 6) [1] "\033[37;48;5;23mA\033[39;49m" "\033[37;48;5;29mB\033[39;49m" [3] "\033[30;48;5;35mC\033[39;49m" "\033[30;48;5;41mD\033[39;49m" [5] "\033[30;48;5;47mE\033[39;49m" "\033[37;48;5;53mF\033[39;49m" [7] "\033[37;48;5;59mG\033[39;49m" "\033[37;48;5;65mH\033[39;49m" [9] "\033[30;48;5;71mI\033[39;49m" "\033[30;48;5;77mJ\033[39;49m" [11] "\033[30;48;5;83mK\033[39;49m" "\033[37;48;5;89mL\033[39;49m" [13] "\033[37;48;5;95mM\033[39;49m" "\033[37;48;5;101mN\033[39;49m" [15] "\033[30;48;5;107mO\033[39;49m" "\033[30;48;5;113mP\033[39;49m" [17] "\033[30;48;5;119mQ\033[39;49m" "\033[37;48;5;125mR\033[39;49m" [19] "\033[37;48;5;131mS\033[39;49m" "\033[37;48;5;137mT\033[39;49m" [21] "\033[30;48;5;143mU\033[39;49m" "\033[30;48;5;149mV\033[39;49m" [23] "\033[30;48;5;155mW\033[39;49m" "\033[37;48;5;161mX\033[39;49m" [25] "\033[37;48;5;167mY\033[39;49m" "\033[37;48;5;173mZ\033[39;49m" 3/14 misc.R: local({ Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "" "a" 3/14 misc.R: unitizer_sect("add_int", { 3/14 misc.R: fansi:::add_int(1, 1) [1] 2 3/14 misc.R: fansi:::add_int(2^31 - 1, 1) Error in fansi:::add_int(2^31 - 1, 1) : Integer overflow in file utils.c at line 99; contact maintainer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: fansi:::add_int(2^31 - 1, 0) [1] 2147483647 3/14 misc.R: fansi:::add_int(-2^31 + 1, 0) [1] -2147483647 3/14 misc.R: fansi:::add_int(-2^31 + 1, -1) Error in fansi:::add_int(-2^31 + 1, -1) : Integer overflow in file utils.c at line 99; contact maintainer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: unitizer_sect("unhandled", { 3/14 misc.R: string.0 <- c("\033[41mhello world\033[m", "foo\033[22>m", "\033[9 3/14 misc.R: unhandled_ctl(string.0) index start stop error translated esc 1 2 4 9 invalid-substr FALSE \033[22>m 2 3 1 6 invalid-substr FALSE \033[999m 3 4 5 11 invalid-substr FALSE \033[31#3m 4 5 2 6 non-SGR/hyperlink FALSE \033[31k 5 6 6 7 non-CSI/OSC FALSE \033m 3/14 misc.R: string.1 <- c("foo\033[22>mhello\033[9999m", "a\033[31k", "hello\0 3/14 misc.R: unhandled_ctl(string.1) index start stop error translated esc 1 1 4 9 invalid-substr FALSE \033[22>m 2 1 15 21 invalid-substr FALSE \033[9999m 3 2 2 6 non-SGR/hyperlink FALSE \033[31k 4 3 6 7 non-CSI/OSC FALSE \033m 5 3 9 14 unknown-substr FALSE \033[180m 6 3 21 21 malformed-ESC FALSE \033 3/14 misc.R: unhandled_ctl("hello\033\033\033[45p wor\ald") index start stop error translated esc 1 1 6 7 malformed-ESC FALSE \033\033 2 1 8 12 non-SGR/hyperlink FALSE \033[45p 3 1 17 17 C0 FALSE \a 3/14 misc.R: unhandled_ctl("\033[38;5;220mworld\033[m", "bright") index start stop error translated esc 1 1 1 11 exceed-term-cap FALSE \033[38;5;220m 3/14 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", "bright") index start stop error translated esc 1 1 1 16 exceed-term-cap FALSE \033[38;2;10;20;30m 3/14 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", "bri") Error in unhandled_ctl("\033[38;2;10;20;30mworld\033[m", "bri") : Argument `term.cap` may only contain values in c("all", "bright", "256", "truecolor", "old") Calls: unitize_dir ... withVisible -> unhandled_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: unhandled_ctl("\033[38;2;10;20;30mworld\033[m", NULL) Error in unhandled_ctl("\033[38;2;10;20;30mworld\033[m", NULL) : Argument `term.cap` must be character. Calls: unitize_dir ... withVisible -> unhandled_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: unhandled_ctl("AB\033[34m\033]9\033\\\033[1m\033[2LCD") index start stop error translated esc 1 1 17 20 non-SGR/hyperlink FALSE \033[2L 3/14 misc.R: unhandled_ctl("AB\033[34m\033]9\033[1m\033[2LCD") index start stop error translated esc 1 1 8 20 malformed-CSI/OSC FALSE \033]9\033[1m\033[2LCD 3/14 misc.R: unhandled_ctl("A\033[45#1pB\033[256pC\033[256mD") index start stop error translated esc 1 1 2 8 CSI/OSC-bad-substr FALSE \033[45#1p 2 1 10 15 non-SGR/hyperlink FALSE \033[256p 3 1 17 22 invalid-substr FALSE \033[256m 3/14 misc.R: unhandled_ctl("\033[38m") index start stop error translated esc 1 1 1 5 invalid-substr FALSE \033[38m 3/14 misc.R: unitizer_sect("strtrim", { 3/14 misc.R: strtrim_ctl(" hello world", 7) [1] " hello " 3/14 misc.R: strtrim_ctl("\033[42m hello world\033[m", 7) [1] "\033[42m hello \033[0m" 3/14 misc.R: strtrim_ctl(" hello\nworld", 7) [1] " hello\nw" 3/14 misc.R: strtrim_ctl("\033[42m hello\nworld\033[m", 7) [1] "\033[42m hello\nw\033[0m" 3/14 misc.R: strtrim_ctl("\nhello\nworld", 7) [1] "\nhello\nwo" 3/14 misc.R: strtrim_ctl("\033[42m\nhello\nworld\033[m", 7) [1] "\033[42m\nhello\nwo\033[0m" 3/14 misc.R: strtrim_ctl("\thello\rworld foobar", 12) Warning in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\thello\rworld f" 3/14 misc.R: strtrim_ctl("\033[42m\thello\rworld\033[m foobar", 12) Warning in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[42m\thello\rworld\033[m f" 3/14 misc.R: strtrim2_ctl("\033[42m\thello world\033[m foobar", 12, tabs.as.spa [1] "\033[42m hell\033[0m" 3/14 misc.R: strtrim_sgr("\033[42m\the\allo world\033[m foobar", 12, warn = FAL [1] "\033[42m\the\allo worl\033[0m" 3/14 misc.R: strtrim2_sgr("\033[42m\the\allo world\033[m foobar", 12, tabs.as.s [1] "\033[42m he\allo wor\033[0m" 3/14 misc.R: identical(strtrim_ctl(c("AB", NA_character_, "CD"), 1), strtrim(c( [1] TRUE 3/14 misc.R: strtrim_ctl(c("AB", NA_character_, "CD"), 1, carry = TRUE) [1] "A" NA NA 3/14 misc.R: hello2.0 <- "\033[42m\thello world\033[m foobar" 3/14 misc.R: strtrim_ctl(1:3, width = 10) [1] "1" "2" "3" 3/14 misc.R: strtrim_ctl(hello2.0, width = "35") Error in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `width` must be a positive scalar numeric representable as an integer. Calls: unitize_dir ... eval -> eval -> withVisible -> strtrim_ctl -> strtrim2_ctl 3/14 misc.R: strtrim_ctl(hello2.0, width = NA_integer_) Error in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `width` must be a positive scalar numeric representable as an integer. Calls: unitize_dir ... eval -> eval -> withVisible -> strtrim_ctl -> strtrim2_ctl 3/14 misc.R: strtrim_ctl(hello2.0, width = 10, warn = NULL) Error in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> strtrim_ctl -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim_ctl(hello2.0, width = 10, ctl = 0) Error in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `ctl` must be character. Calls: unitize_dir ... withVisible -> strtrim_ctl -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim_ctl(hello2.0, width = 10, ctl = "bananas") Error in strtrim2_ctl(x = x, width = width, warn = warn, ctl = ctl, normalize = normalize, : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... withVisible -> strtrim_ctl -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(1:3, width = 10) [1] "1" "2" "3" 3/14 misc.R: strtrim2_ctl(hello2.0, width = "35") Error in strtrim2_ctl(hello2.0, width = "35") : Argument `width` must be a positive scalar numeric representable as an integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strtrim2_ctl 3/14 misc.R: strtrim2_ctl(hello2.0, width = NA_integer_) Error in strtrim2_ctl(hello2.0, width = NA_integer_) : Argument `width` must be a positive scalar numeric representable as an integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strtrim2_ctl 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, warn = NULL) Error in strtrim2_ctl(hello2.0, width = 10, warn = NULL) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = NA) Error in strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = NA) : Argument `tabs.as.spaces` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = 1:3) Error in strtrim2_ctl(hello2.0, width = 10, tabs.as.spaces = 1:3) : Argument `tabs.as.spaces` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, tab.stops = -(1:3)) Error in strtrim2_ctl(hello2.0, width = 10, tab.stops = -(1:3)) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, tab.stops = 0) Error in strtrim2_ctl(hello2.0, width = 10, tab.stops = 0) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, ctl = 0) Error in strtrim2_ctl(hello2.0, width = 10, ctl = 0) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: strtrim2_ctl(hello2.0, width = 10, ctl = "bananas") Error in strtrim2_ctl(hello2.0, width = 10, ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> strtrim2_ctl -> VAL_IN_ENV -> stop2 3/14 misc.R: unitizer_sect("enc check", { 3/14 misc.R: x <- y <- "He\x9f" 3/14 misc.R: Encoding(x) <- "latin1" 3/14 misc.R: fansi:::check_enc(x, 1) Error in fansi:::check_enc(x, 1) : Internal Error: unexpected encoding 2 encountered at index 1. Contact maintainer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: Encoding(y) <- "bytes" 3/14 misc.R: fansi:::check_enc(y, 1) Error in fansi:::check_enc(y, 1) : Byte encoded string encountered at index 1. Byte encoded strings are not supported. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: fansi:::check_enc("hello", 1) [1] TRUE 3/14 misc.R: unitizer_sect("what as int", { 3/14 misc.R: fansi:::ctl_as_int(c(1, 2, 3, 4, 5)) [1] 112 3/14 misc.R: fansi:::ctl_as_int(c(2, 3, 4, 5)) [1] 15 3/14 misc.R: fansi:::ctl_as_int(c(1, 2, 3, 9)) Error in fansi:::ctl_as_int(c(1, 2, 3, 9)) : Internal Error: max ctl value allowed is 6. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: fansi:::ctl_as_int(c(2, 3, 9)) Error in fansi:::ctl_as_int(c(2, 3, 9)) : Internal Error: max ctl value allowed is 6. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: unitizer_sect("HTML helper", { 3/14 misc.R: html_esc(character()) character(0) 3/14 misc.R: html_esc(1:10) Error in html_esc(1:10) : Argument `x` must be character, is integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc 3/14 misc.R: html_esc(NA_character_) [1] NA 3/14 misc.R: html_esc("") [1] "<he&llo>" 3/14 misc.R: html_esc("ow&wo") [1] "ow&wo" 3/14 misc.R: html_esc(c("hello", "wors", NA, "")) [1] "hello" "wor<ld>s" NA "" 3/14 misc.R: html_esc(c("he'l\"lo", "wors", NA, "")) [1] "he'l"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc("<<<<") [1] "<<<<" 3/14 misc.R: html_esc("<123hello>") [1] "<123hello>" 3/14 misc.R: txt <- c("day > night", "hello world") 3/14 misc.R: html_code_block(character()) [1] "
" 3/14 misc.R: html_code_block(txt) [1] "
day > night\nhello world
" 3/14 misc.R: html_code_block(1:10) Error in html_code_block(1:10) : Argument `x` must be character, is integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_code_block 3/14 misc.R: html_code_block(txt, class = c("not-fansi", "plain")) [1] "
day > night\nhello world
" 3/14 misc.R: html_code_block(txt, class = NULL) Error in html_code_block(txt, class = NULL) : Argument `class` must be character, is NULL. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_code_block 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "<>") [1] "h&e'l\"lo" "wor<ld>s" NA "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "><") [1] "h&e'l\"lo" "wor<ld>s" NA "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "<&>") [1] "h&e'l\"lo" "wor<ld>s" NA "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'<&>") [1] "h&e'l\"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'<&>\"") [1] "h&e'l"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'&>\"<") [1] "h&e'l"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "") [1] "h&e'l\"lo" "wors" NA "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'<&>\"<") [1] "h&e'l"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), character()) Error in html_esc(c("h&e'l\"lo", "wors", NA, ""), character()) : Argument `what` must be scalar character and not NA. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), NA_character_) Error in html_esc(c("h&e'l\"lo", "wors", NA, ""), NA_character_) : Argument `what` must be scalar character and not NA. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), 1:5) Error in html_esc(c("h&e'l\"lo", "wors", NA, ""), 1:5) : Argument `what` must be character, is integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'<&><") [1] "h&e'l\"lo" "wor<ld>s" NA [4] "" 3/14 misc.R: html_esc(c("h&e'l\"lo", "wors", NA, ""), "'x><") Error in html_esc(c("h&e'l\"lo", "wors", NA, ""), "'x><") : Argument `what` may only contain ASCII characters "&", "<", ">", "'", or "\"". Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc 3/14 misc.R: unitizer_sect("hooks", { 3/14 misc.R: h.1 <- list(set = function(...) cat("Set hooks: ", names(list(...) 3/14 misc.R: h.2 <- list(set = function(...) cat("Set hooks: ", names(list(...) 3/14 misc.R: h.3 <- list(set = function(...) cat("Set hooks: ", names(list(...) 3/14 misc.R: h.4 <- list(set = function(...) stop("error in set"), get = functi 3/14 misc.R: set_knit_hooks(list(1, 2)) Error in set_knit_hooks(list(1, 2)) : Argument `hooks` does not appear to be `knitr::knit_hooks`. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(list(function() NULL, function() NULL)) Error in set_knit_hooks(list(function() NULL, function() NULL)) : Argument `hooks` does not appear to be `knitr::knit_hooks`. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: res1 <- set_knit_hooks(h.1, .test = TRUE) Set hooks: output 3/14 misc.R: res1[["new.hooks"]][["output"]]("hello") [1] "old.hook" 3/14 misc.R: res1[["new.hooks"]][["output"]]("hello\033[31m world") [1] "
hello world
" 3/14 misc.R: res1a <- set_knit_hooks(h.1, split.nl = TRUE, .test = TRUE) Set hooks: output 3/14 misc.R: res1a[["new.hooks"]][["output"]]("hello\033[31m wo\nrld") [1] "
hello wo\nrld
" 3/14 misc.R: p.f.2 <- function(x, y) NULL 3/14 misc.R: p.f.3 <- function(x, class) sprintf("new proc fun, '%s'", class) 3/14 misc.R: p.f.4 <- function(x, class) stop("new proc fun") 3/14 misc.R: set_knit_hooks(h.1, split.nl = "banana") Error in set_knit_hooks(h.1, split.nl = "banana") : Argument `split.n` must be TRUE or FALSE Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, proc.fun = p.f.2) Error in set_knit_hooks(h.1, proc.fun = p.f.2) : Argument `proc.fun` must be a function with formals named `x` and `class`. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, which = "hello") Error in set_knit_hooks(h.1, which = "hello") : Argument `which` must be character containing values in c("output", "warning", "error", "message") Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, which = NULL) Error in set_knit_hooks(h.1, which = NULL) : Argument `which` must be character containing values in c("output", "warning", "error", "message") Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: res2 <- set_knit_hooks(h.1, which = c("output", "message"), class Set hooks: output message 3/14 misc.R: res2[["new.hooks"]][["message"]]("hello") [1] "old.hook" 3/14 misc.R: res2[["new.hooks"]][["message"]]("hello\033[31m world") [1] "new proc fun, 'f-message'" 3/14 misc.R: res2[["new.hooks"]][["output"]]("hello\033[31m world") [1] "new proc fun, 'f-output'" 3/14 misc.R: res3 <- set_knit_hooks(h.1, which = c("message", "warning"), Set hooks: message warning 3/14 misc.R: res3[["new.hooks"]][["warning"]]("hello") [1] "old.hook" 3/14 misc.R: res3[["new.hooks"]][["warning"]]("hello\033[31mworld") Error in proc.fun(x = x, class = class) : new proc fun Error in res3[["new.hooks"]][["warning"]]("hello\033[31mworld") : Argument `proc.fun` for `set_knit_hooks` caused an error when processing output; see prior error. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 3/14 misc.R: set_knit_hooks(h.2) Warning in set_knit_hooks(h.2) : Retrieved 'output' hook is not a function; are you sure you passed `knitr::knit_hooks` as the `hooks` argument? Quitting after setting 0/1 hooks Set hooks: output $output NULL 3/14 misc.R: set_knit_hooks(h.3) Error in hooks$get(hook.name) : error in get Warning in set_knit_hooks(h.3) : Failed retrieving 'output' hook from the knit hooks; are you sure you passed `knitr::knit_hooks` as the `hooks` argument? Quitting after setting 0/1 hooks Set hooks: output $output NULL 3/14 misc.R: set_knit_hooks(h.4) Error in (function (...) : error in set Warning in set_knit_hooks(h.4) : Failure while trying to set hooks; see prior error; are you sure you passed `knitr::knit_hooks` as the `hooks` argument? $output function() "old.hook" 3/14 misc.R: set_knit_hooks(h.1, style = NULL) Error in set_knit_hooks(h.1, style = NULL) : Argument `style` must be character. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, class = 1:10) Error in set_knit_hooks(h.1, class = 1:10) : Argument `class` should be a character vector the same length as `which`. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, class = letters) Error in set_knit_hooks(h.1, class = letters) : Argument `class` should be a character vector the same length as `which`. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: set_knit_hooks(h.1, which = c("output", "message", "output")) Error in set_knit_hooks(h.1, which = c("output", "message", "output")) : Argument `which` may not contain duplicate values (output). Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> set_knit_hooks 3/14 misc.R: unitizer_sect("output funs", { 3/14 misc.R: fansi_lines(1:3) [1] "\033[37;48;5;18m1\033[39;49m" "\033[37;48;5;19m2\033[39;49m" [3] "\033[37;48;5;20m3\033[39;49m" 3/14 misc.R: fansi_lines(1:3, step = "hello") Error in fansi_lines(1:3, step = "hello") : Argument `step` must be a strictly positive scalar integer. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> fansi_lines 3/14 misc.R: capture.output(fwl("\033[43mhello")) [1] "\033[43mhello" "\033[0m" 3/14 misc.R: unitizer_sect("validation", { 3/14 misc.R: fansi:::VAL_IN_ENV(booboo = "error") Error in fansi:::VAL_IN_ENV(booboo = "error") : Internal Error: some arguments to validate unknown Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 4/14 nchar.R: 4/14 nchar.R: library(fansi) 4/14 nchar.R: unitizer_sect("basic tests", { 4/14 nchar.R: nchar_ctl(c("hello", "world")) [1] 5 5 4/14 nchar.R: nchar_ctl(c("hello", "world"), type = "width") [1] 5 5 4/14 nchar.R: nchar_ctl(c("hello", "world"), type = "wi") [1] 5 5 4/14 nchar.R: na.world <- c("hello", NA, "world", "") 4/14 nchar.R: identical(nchar_ctl(na.world), nchar(na.world)) [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, keepNA = FALSE), nchar(na.world, [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, keepNA = NA, type = "width"), nchar [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, keepNA = TRUE, type = "width"), [1] TRUE 4/14 nchar.R: identical(nzchar_ctl(na.world), nzchar(na.world)) [1] TRUE 4/14 nchar.R: identical(nzchar_ctl(na.world, keepNA = TRUE), nzchar(na.world, [1] TRUE 4/14 nchar.R: identical(nzchar_ctl(na.world, keepNA = NA), nzchar(na.world, [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, type = "bytes"), nchar(na.world, [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, keepNA = FALSE, type = "bytes"), [1] TRUE 4/14 nchar.R: identical(nchar_ctl(na.world, keepNA = TRUE, type = "bytes"), [1] TRUE 4/14 nchar.R: w.names <- c(a = "hello", b = "world") 4/14 nchar.R: identical(nchar_ctl(w.names), nchar(w.names)) [1] TRUE 4/14 nchar.R: w.dim <- matrix(letters[1:6], 2, 3, dimnames = list(X = LETTERS[2 4/14 nchar.R: identical(nchar_ctl(w.dim), nchar(w.dim)) [1] TRUE 4/14 nchar.R: hw.sgr <- c("hello", "wo\033[42mrld", "\033[31m", "mo\non", "star 4/14 nchar.R: identical(nchar_ctl(hw.sgr), nchar(strip_ctl(hw.sgr))) [1] TRUE 4/14 nchar.R: x <- "\xf0" 4/14 nchar.R: if (isTRUE(l10n_info()[["UTF-8"]])) { [1] TRUE 4/14 nchar.R: Encoding(x) <- "UTF-8" 4/14 nchar.R: identical(nzchar_ctl(x), nzchar(x)) [1] TRUE 4/14 nchar.R: nchar_ctl(x) Error in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> nchar_ctl_internal 4/14 nchar.R: nchar_ctl(c("", x)) Error in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed UTF-8 sequence at index [2], see `?unhandled_ctl`. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> nchar_ctl_internal 4/14 nchar.R: identical(nchar_ctl(x, allowNA = TRUE), nchar(x, allowNA = TRUE)) [1] TRUE 4/14 nchar.R: unitizer_sect("with escapes", { 4/14 nchar.R: esc.2 <- "\n\r\033P\033[31m\a" 4/14 nchar.R: nchar_ctl(esc.2) [1] 0 4/14 nchar.R: nchar_ctl(esc.2, warn = FALSE) [1] 0 4/14 nchar.R: nzchar_ctl(esc.2) [1] FALSE 4/14 nchar.R: nzchar_ctl(esc.2, warn = FALSE) [1] FALSE 4/14 nchar.R: nchar_ctl("\033[31#mworld", ctl = "sgr") [1] 5 4/14 nchar.R: nchar_ctl("\033[31#mworld", ctl = "csi") [1] 11 4/14 nchar.R: unitizer_sect("ctl", { 4/14 nchar.R: esc.3 <- "\n\t\033[31m\033[41!m\033p" 4/14 nchar.R: nzchar_ctl(esc.3, warn = FALSE) [1] FALSE 4/14 nchar.R: nzchar_ctl(sprintf("%sa", esc.3), warn = FALSE) [1] TRUE 4/14 nchar.R: nzchar_ctl(esc.3, ctl = c("sgr", "csi", "esc"), warn = FALSE) [1] TRUE 4/14 nchar.R: nzchar_ctl(esc.3, ctl = c("c0", "nl"), warn = FALSE) [1] TRUE 4/14 nchar.R: nzchar_ctl("\n\t\n", ctl = c("nl"), warn = FALSE) [1] TRUE 4/14 nchar.R: nzchar_ctl("\t\n", ctl = c("nl"), warn = FALSE) [1] TRUE 4/14 nchar.R: unitizer_sect("corner cases", { 4/14 nchar.R: ncbad <- c("\033\x80", "\033[31;\x80m", "\033[31;\x80p", "\033]8; 4/14 nchar.R: Encoding(ncbad) <- "UTF-8" 4/14 nchar.R: nchar_ctl(ncbad) [1] 0 0 0 0 0 4/14 nchar.R: fansi:::set_rver(numeric_version("3.2.1")) 4/14 nchar.R: nzchar_ctl(c("\033[31mA", "\033[31m")) [1] TRUE FALSE 4/14 nchar.R: nchar_ctl(c("\033[31mA", "\033[31m")) [1] 1 0 4/14 nchar.R: fansi:::set_rver() 4/14 nchar.R: unitizer_sect("bad inputs", { 4/14 nchar.R: nchar_ctl(9:10, warn = 1:3) Error in nchar_ctl(9:10, warn = 1:3) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", allowNA = 1:3) Error in nchar_ctl("hello\033[31m world", allowNA = 1:3) : Argument `allowNA` must be interpretable as a scalar logical. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", keepNA = 1:3) Error in nchar_ctl("hello\033[31m world", keepNA = 1:3) : Argument `keepNA` must be interpretable as a scalar logical. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", strip = 1:3) Parameter `strip` has been deprecated; use `ctl` instead. Error in nchar_ctl("hello\033[31m world", strip = 1:3) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", ctl = "bananas") Error in nchar_ctl("hello\033[31m world", ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", type = NA_character_) Error in nchar_ctl("hello\033[31m world", type = NA_character_) : Argument `type` must partial match one of c("chars", "width", "graphemes", "bytes") Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", type = 1) Error in nchar_ctl("hello\033[31m world", type = 1) : Argument `type` must partial match one of c("chars", "width", "graphemes", "bytes") Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nchar_ctl("hello\033[31m world", type = "bananas") Error in nchar_ctl("hello\033[31m world", type = "bananas") : Argument `type` must partial match one of c("chars", "width", "graphemes", "bytes") Calls: unitize_dir ... eval -> withVisible -> nchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nzchar_ctl(9:10, warn = 1:3) Error in nzchar_ctl(9:10, warn = 1:3) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> nzchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nzchar_ctl("hello\033[31m world", keepNA = 1:3) Error in nzchar_ctl("hello\033[31m world", keepNA = 1:3) : Argument `keepNA` must be interpretable as a scalar logical. Calls: unitize_dir ... eval -> withVisible -> nzchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nzchar_ctl("hello\033[31m world", ctl = 1) Error in nzchar_ctl("hello\033[31m world", ctl = 1) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> nzchar_ctl -> VAL_IN_ENV -> stop2 4/14 nchar.R: nzchar_ctl("hello\033[31m world", ctl = "bananas") Error in nzchar_ctl("hello\033[31m world", ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> nzchar_ctl -> VAL_IN_ENV -> stop2 5/14 normalize.R: 5/14 normalize.R: library(fansi) 5/14 normalize.R: unitizer_sect("no expansion", { 5/14 normalize.R: normalize_state("A\033[31mB") [1] "A\033[31mB" 5/14 normalize.R: normalize_state("\033[31mAB") [1] "\033[31mAB" 5/14 normalize.R: normalize_state("AB\033[31m") [1] "AB\033[31m" 5/14 normalize.R: normalize_state(c("A\033[31mB", "AB")) [1] "A\033[31mB" "AB" 5/14 normalize.R: normalize_state(c("\033[31mAB", "AB")) [1] "\033[31mAB" "AB" 5/14 normalize.R: normalize_state(c("AB\033[31m", "AB")) [1] "AB\033[31m" "AB" 5/14 normalize.R: unitizer_sect("simple expansion", { 5/14 normalize.R: normalize_state(c("A\033[31;42mB", "AB")) [1] "A\033[31m\033[42mB" "AB" 5/14 normalize.R: normalize_state(c("\033[31;42mAB", "AB")) [1] "\033[31m\033[42mAB" "AB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", "AB")) [1] "AB\033[31m\033[42m" "AB" 5/14 normalize.R: normalize_state(c("A\033[31;42mB", "A\033[39;4mB")) [1] "A\033[31m\033[42mB" "A\033[4mB" 5/14 normalize.R: normalize_state(c("A\033[31;42mB", "\033[39;4mAB")) [1] "A\033[31m\033[42mB" "\033[4mAB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", "A\033[39;4mB")) [1] "AB\033[31m\033[42m" "A\033[4mB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", "A\033[0;4mB")) [1] "AB\033[31m\033[42m" "A\033[4mB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", "AB\033[0;4m")) [1] "AB\033[31m\033[42m" "AB\033[4m" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", "\033[0;4mAB")) [1] "AB\033[31m\033[42m" "\033[4mAB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", NA, "\033[0;4mAB")) [1] "AB\033[31m\033[42m" NA "\033[4mAB" 5/14 normalize.R: normalize_state(c("AB\033[31;42m", NA, "\033[0;4mAB"), carry [1] "AB\033[31m\033[42m" NA NA 5/14 normalize.R: unitizer_sect("superflous codes", { 5/14 normalize.R: normalize_state(c("A\033[31;44;38;5;226;36mBC\033[mD")) [1] "A\033[36m\033[44mBC\033[39m\033[49mD" 5/14 normalize.R: normalize_state(c("A\033[31;44;38;5;226;36m\033[0mBCD")) [1] "ABCD" 5/14 normalize.R: unitizer_sect("broad code test", { 5/14 normalize.R: normalize_state(c("A\033[33;44mB\033[1;3;4mCD\033[mE")) [1] "A\033[33m\033[44mB\033[1m\033[3m\033[4mCD\033[22m\033[23m\033[24m\033[39m\033[49mE" 5/14 normalize.R: normalize_state("A\033[33;44mB\033[1;2;3;4;5;6;7;8;9;11;21;26 [1] "A\033[33m\033[44mB\033[1m\033[2m\033[3m\033[4m\033[5m\033[6m\033[7m\033[8m\033[9m\033[21m\033[26m\033[51m\033[52m\033[53m\033[60m\033[61m\033[62m\033[63m\033[64m\033[11mC\033[10m\033[22m\033[23m\033[24m\033[25m\033[27m\033[28m\033[29m\033[39m\033[49m\033[50m\033[54m\033[55m\033[65m" 5/14 normalize.R: unhandled_ctl(normalize_state("A\033[33;44mB\033[1;2;3;4;5;6; [1] index start stop error translated esc <0 rows> (or 0-length row.names) 5/14 normalize.R: normalize_state("A\033[33;44mB\033[1;2;3;4;5;6;7;8;9;11;21;26 [1] "A\033[33m\033[44mB\033[39m\033[49mC" 5/14 normalize.R: normalize_state("A\033[33;44mB\033[1;2;3;4;5;6;7;8;9;11;21;26 [1] "A\033[33m\033[44mB\033[1m\033[2m\033[3m\033[4m\033[5m\033[6m\033[7m\033[8m\033[9m\033[21m\033[26m\033[51m\033[52m\033[53m\033[60m\033[61m\033[62m\033[63m\033[64m\033[11mC\033[10m\033[22m\033[23m\033[24m\033[25m\033[27m\033[28m\033[29m\033[39m\033[49m\033[50m\033[54m\033[55m\033[65mD" 5/14 normalize.R: unitizer_sect("errors and warnings", { 5/14 normalize.R: normalize_state(list(1, 2, 3)) [1] "1" "2" "3" 5/14 normalize.R: x <- c("A\033[38;2;100;150;3;36mBC\033[mD") 5/14 normalize.R: normalize_state(x, term.cap = c("old")) Warning in normalize_state(x, term.cap = c("old")) : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "A\033[2m\033[3m\033[36mBC\033[22m\033[23m\033[39mD" 5/14 normalize.R: normalize_state(x, term.cap = c("bright", "old")) Warning in normalize_state(x, term.cap = c("bright", "old")) : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "A\033[2m\033[3m\033[36m\033[100mBC\033[22m\033[23m\033[39m\033[49mD" 5/14 normalize.R: normalize_state(x, term.cap = character()) Warning in normalize_state(x, term.cap = character()) : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "A\033[36mBC\033[39mD" 5/14 normalize.R: normalize_state(x, term.cap = c("bright")) Warning in normalize_state(x, term.cap = c("bright")) : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "A\033[36mBC\033[39mD" 5/14 normalize.R: normalize_state(x, term.cap = c("bright", "256", "truecolor") [1] "A\033[36mBC\033[39mD" 5/14 normalize.R: substr_ctl(x, 1, 2, normalize = "yeah baby") Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `normalize` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 5/14 normalize.R: substr_ctl(x, 1, 2, normalize = NA) Error in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : Argument `normalize` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> VAL_IN_ENV -> stop2 5/14 normalize.R: unitizer_sect("in functions", { 5/14 normalize.R: string1 <- "hello \033[33;44mblue world" 5/14 normalize.R: string2 <- "\033[4;1mgoodbye\033[7m white \033[mmoon" 5/14 normalize.R: string3 <- c(string1, string2) 5/14 normalize.R: strwrap_ctl(string1, 11, normalize = TRUE) [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld\033[39m\033[49m" 5/14 normalize.R: strwrap_ctl(string2, 11, normalize = TRUE) [1] "\033[1m\033[4mgoodbye\033[22m\033[24m" [2] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strwrap_ctl(string3, 11, normalize = TRUE) [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld\033[39m\033[49m" [3] "\033[1m\033[4mgoodbye\033[22m\033[24m" [4] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strwrap_ctl(string3, 11, normalize = TRUE, simplify = FALSE) [[1]] [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld\033[39m\033[49m" [[2]] [1] "\033[1m\033[4mgoodbye\033[22m\033[24m" [2] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strwrap2_ctl(string3, 11, normalize = TRUE, pad.end = " ") [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld \033[39m\033[49m" [3] "\033[1m\033[4mgoodbye\033[7m \033[22m\033[24m\033[27m" [4] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strwrap_sgr(string3, 11, normalize = TRUE) [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld\033[39m\033[49m" [3] "\033[1m\033[4mgoodbye\033[22m\033[24m" [4] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strwrap2_sgr(string3, 11, normalize = TRUE, pad.end = " ") [1] "hello \033[33m\033[44mblue\033[39m\033[49m" [2] "\033[33m\033[44mworld \033[39m\033[49m" [3] "\033[1m\033[4mgoodbye\033[7m \033[22m\033[24m\033[27m" [4] "\033[1m\033[4m\033[7mwhite \033[22m\033[24m\033[27mmoon" 5/14 normalize.R: strtrim_sgr(string3, 8, normalize = TRUE) [1] "hello \033[33m\033[44mbl\033[39m\033[49m" [2] "\033[1m\033[4mgoodbye\033[7m \033[22m\033[24m\033[27m" 5/14 normalize.R: strtrim_sgr(string3, 8, normalize = TRUE) [1] "hello \033[33m\033[44mbl\033[39m\033[49m" [2] "\033[1m\033[4mgoodbye\033[7m \033[22m\033[24m\033[27m" 5/14 normalize.R: substr_ctl("\033[33;44mhello\033[m world", 3, 8, normalize = [1] "\033[33m\033[44mllo\033[39m\033[49m wo" 5/14 normalize.R: substr2_ctl("\033[33;44mhello\033[m world", 3, 8, normalize = [1] "\033[33m\033[44mllo\033[39m\033[49m wo" 5/14 normalize.R: substr_sgr("\033[33;44mhello\033[m world", 3, 8, normalize = [1] "\033[33m\033[44mllo\033[39m\033[49m wo" 5/14 normalize.R: substr2_sgr("\033[33;44mhello\033[m world", 3, 8, normalize = [1] "\033[33m\033[44mllo\033[39m\033[49m wo" 5/14 normalize.R: substr_ctl(string3, c(3, 3), c(8, 15), normalize = TRUE) [1] "llo \033[33m\033[44mbl\033[39m\033[49m" [2] "\033[1m\033[4modbye\033[7m white \033[22m\033[24m\033[27mm" 5/14 normalize.R: strsplit_ctl(string3, " ", normalize = TRUE) [[1]] [1] "hello" [2] "\033[33m\033[44mblue\033[39m\033[49m" [3] "\033[33m\033[44mworld\033[39m\033[49m" [[2]] [1] "\033[1m\033[4mgoodbye\033[22m\033[24m" [2] "\033[1m\033[4m\033[7mwhite\033[22m\033[24m\033[27m" [3] "moon" 6/14 overflow.R: 6/14 overflow.R: library(fansi) 6/14 overflow.R: old_max <- fansi:::set_int_max(15) 6/14 overflow.R: unitizer_sect("tabs", { 6/14 overflow.R: tabs_as_spaces("\t1234567") [1] " 1234567" 6/14 overflow.R: tryCatch(tabs_as_spaces("\t12345678"), error = conditionMessag [1] "Converting tabs to spaces will cause string to be longer than allowed INT_MAX." 6/14 overflow.R: invisible(fansi:::set_int_max(12)) 6/14 overflow.R: tabs_as_spaces(c("\t", "\t123")) [1] " " " 123" 6/14 overflow.R: unitizer_sect("wrap", { 6/14 overflow.R: invisible(fansi:::set_int_max(15)) 6/14 overflow.R: string <- "0123456789" 6/14 overflow.R: strwrap_ctl(string, 16) [1] "0123456789" 6/14 overflow.R: strwrap2_ctl(string, 16, pad.end = " ") [1] "0123456789 " 6/14 overflow.R: tce(strwrap2_ctl(string, 17, pad.end = " ")) [1] "Adding padding will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: strwrap_ctl(string, 16, prefix = "-----") [1] "-----0123456789" 6/14 overflow.R: tce(strwrap_ctl(string, 16, prefix = "------")) [1] "Adding prefix characters will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: strwrap_ctl(string, 16, indent = 5) [1] " 0123456789" 6/14 overflow.R: tce(strwrap_ctl(string, 16, indent = 6)) [1] "Adding prefix characters will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: strwrap_ctl(string, 16, indent = 2, prefix = "---") [1] "--- 0123456789" 6/14 overflow.R: tce(strwrap_ctl(string, 16, indent = 3, prefix = "---")) [1] "Adding prefix characters will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: string2 <- "012345678901234" 6/14 overflow.R: string3 <- "0123456789012345" 6/14 overflow.R: strwrap_ctl(string2, 16) [1] "012345678901234" 6/14 overflow.R: tce(strwrap_ctl(string3, 16)) [1] "Strings longer than INT_MAX not supported (length 16 at index 1)." 6/14 overflow.R: string4 <- "\033[31m0123456789" 6/14 overflow.R: tce(strwrap_ctl(string4, 16)) [1] "Generating closing SGR will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: invisible(fansi:::set_int_max(9)) 6/14 overflow.R: tce(strwrap_ctl("A\033[31m a", 5)) [1] "Generating closing SGR will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: unitizer_sect("html", { 6/14 overflow.R: invisible(fansi:::set_int_max(38)) 6/14 overflow.R: sgr_to_html("\033[31ma") [1] "a" 6/14 overflow.R: tce(sgr_to_html("\033[31mab")) [1] "Expanding SGR sequences to HTML will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: tce(sgr_to_html("\033[31m\033[42mhello")) [1] "Expanding SGR sequences to HTML will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: invisible(fansi:::set_int_max(57)) 6/14 overflow.R: tce(sgr_to_html("\033[31m\033[42mhello", classes = TRUE)) [1] "Expanding SGR sequences to HTML will create string longer than INT_MAX at index [1]. Try again with smaller strings." 6/14 overflow.R: invisible(fansi:::set_int_max(58)) 6/14 overflow.R: (x <- sgr_to_html("\033[31m\033[42mhello", classes = TRUE)) [1] "hello" 6/14 overflow.R: nchar(x) [1] 58 6/14 overflow.R: invisible(fansi:::set_int_max(4)) 6/14 overflow.R: tce(sgr_to_html("hello")) [1] "Strings longer than INT_MAX not supported (length 5 at index 1)." 6/14 overflow.R: tce(html_esc("hello")) [1] "Strings longer than INT_MAX not supported (length 5 at index 1)." 6/14 overflow.R: tce(html_esc("<")) [1] "<" 6/14 overflow.R: tce(html_esc(" eval -> eval -> withVisible -> 6/14 overflow.R: invisible(fansi:::set_int_max(130)) 6/14 overflow.R: fansi:::size_buff(c(0L, 127L, 128L, 64L, 200L, 1024L)) Error in fansi:::size_buff(c(0L, 127L, 128L, 64L, 200L, 1024L)) : Internal Error: max allowed buffer size is INT_MAX + 1. (req: 201 vs lim: 131), in FANSI_size_buff_ext. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 6/14 overflow.R: invisible(fansi:::set_int_max(64)) 6/14 overflow.R: fansi:::size_buff(c(0L, 32L, 63L, 64L)) [1] 1 33 65 65 6/14 overflow.R: fansi:::size_buff(c(0L, 32L, 63L, 65L)) Error in fansi:::size_buff(c(0L, 32L, 63L, 65L)) : Internal Error: max allowed buffer size is INT_MAX + 1. (req: 66 vs lim: 65), in FANSI_size_buff_ext. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 6/14 overflow.R: invisible(fansi:::set_int_max(old_max)) 6/14 overflow.R: dat <- fansi:::size_buff_prot_test() Warning in fansi:::size_buff_prot_test() : Unable to release buffer allocated by FANSI_size_buff_prot_test while in native code. Buffer will be released on return to R. Warning in fansi:::size_buff_prot_test() : Unable to release buffer allocated by FANSI_size_buff_prot_test while in native code. Buffer will be released on return to R. 6/14 overflow.R: dat["first", "self"] == dat["smaller 1.0", "self"] [1] TRUE 6/14 overflow.R: dat["new buff", "prev"] == dat["grow 1.0", "self"] [1] TRUE 6/14 overflow.R: dat["new buff", "prev"] != dat["new buff", "self"] [1] TRUE 6/14 overflow.R: dat["smaller 1.1", "self"] == dat["grow 1.0", "self"] [1] TRUE 6/14 overflow.R: dat["smaller 2.0", "self"] == dat["new buff", "self"] [1] TRUE 6/14 overflow.R: dat["smaller 2.0", "prev"] == dat["new buff", "prev"] [1] TRUE 6/14 overflow.R: dat["smaller 2.0", "prev"] == dat["grow 2.0", "prev"] [1] TRUE 6/14 overflow.R: dat["grow 1.1", "prev"] == dat["grow 2.0", "self"] [1] TRUE 6/14 overflow.R: dat["grow 2.1", "prev"] == dat["grow 1.1", "self"] [1] TRUE 6/14 overflow.R: unitizer_sect("misc", { 6/14 overflow.R: invisible(fansi:::set_int_max(5)) 6/14 overflow.R: substr_ctl("\033[43mA B", 5, 5) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Strings longer than INT_MAX not supported (length 8 at index 1). Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal 6/14 overflow.R: substr_ctl("12345", 1, 5) [1] "12345" 6/14 overflow.R: substr_ctl("123456", 1, 6) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Strings longer than INT_MAX not supported (length 6 at index 1). Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal 6/14 overflow.R: fansi:::reset_limits() [1] TRUE 6/14 overflow.R: unitizer_sect("R_len_t", { 6/14 overflow.R: old_rlent <- fansi:::set_rlent_max(5) 6/14 overflow.R: tabs_as_spaces("A\tB") Error in tabs_as_spaces("A\tB") : Attempting to create CHARSXP longer than R_LEN_T_MAX at index [1]. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> tabs_as_spaces 6/14 overflow.R: new_rlent <- fansi:::set_rlent_max(old_rlent) 6/14 overflow.R: fansi:::reset_limits() [1] TRUE 6/14 overflow.R: unitizer_sect("internal", { 6/14 overflow.R: tce(.Call(fansi:::FANSI_buff_test_reset)) [1] "Internal Error: attempt to size buffer w/o reset in FANSI_buff_test_reset." 6/14 overflow.R: tce(.Call(fansi:::FANSI_buff_test_copy_overflow)) [1] "Internal Error: exceeded target buffer size in _copy." 6/14 overflow.R: tce(.Call(fansi:::FANSI_buff_test_mcopy_overflow)) [1] "Internal Error: exceeded target buffer size in _mcopy." 6/14 overflow.R: tce(.Call(fansi:::FANSI_buff_test_fill_overflow)) [1] "Internal Error: exceeded allocated buffer in _fill." 7/14 strip.R: 7/14 strip.R: library(fansi) 7/14 strip.R: unitizer_sect("Strip ansi", { 7/14 strip.R: strip_ctl(sprintf("hello %sworld%s", red, end)) [1] "hello world" 7/14 strip.R: strip_ctl(sprintf("he%sllo %sworld", red, end)) [1] "hello world" 7/14 strip.R: strip_ctl(sprintf("%shello %sworld%s", grn.bg, red, end)) [1] "hello world" 7/14 strip.R: strip_ctl(sprintf("%s%shello %sworld%s", grn.bg, inv, red, end)) [1] "hello world" 7/14 strip.R: string <- paste("string", format(1:10)) 7/14 strip.R: string[c(2, 4, 6)] <- paste0(red, string[c(2, 4, 6)], end) 7/14 strip.R: strip_ctl(string) [1] "string 1" "string 2" "string 3" "string 4" "string 5" "string 6" [7] "string 7" "string 8" "string 9" "string 10" 7/14 strip.R: strip_sgr(string) [1] "string 1" "string 2" "string 3" "string 4" "string 5" "string 6" [7] "string 7" "string 8" "string 9" "string 10" 7/14 strip.R: strip_sgr(1:3) [1] "1" "2" "3" 7/14 strip.R: unitizer_sect("Corner cases", { 7/14 strip.R: strip_ctl("hello\033") Warning in strip_ctl("hello\033") : Argument `x` contains a malformed escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" 7/14 strip.R: strip_ctl("hello\033", ctl = c("nl", "c0")) [1] "hello\033" 7/14 strip.R: strip_ctl("hello\033[") Warning in strip_ctl("hello\033[") : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" 7/14 strip.R: strip_ctl("hello\033[42") Warning in strip_ctl("hello\033[42") : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" 7/14 strip.R: strip_ctl("hello\033[42", ctl = c("all", "csi", "sgr")) [1] "hello42" 7/14 strip.R: strip_ctl("hello\033[31##3m illegal") [1] "hello illegal" 7/14 strip.R: strip_ctl("hello\033[31##m legal") [1] "hello legal" 7/14 strip.R: strip_ctl(1:3) [1] "1" "2" "3" 7/14 strip.R: unitizer_sect("Whitespace", { 7/14 strip.R: fansi:::process("hello world") [1] "hello world" 7/14 strip.R: fansi:::process("hello. world") [1] "hello. world" 7/14 strip.R: fansi:::process(c("hello world", "hello. world")) [1] "hello world" "hello. world" 7/14 strip.R: fansi:::process("hello. world? moon! wow.") [1] "hello. world? moon! wow." 7/14 strip.R: fansi:::process(" hello") [1] "hello" 7/14 strip.R: fansi:::process(" hello\n world") [1] "hello world" 7/14 strip.R: fansi:::process(" hello \n world") [1] "hello world" 7/14 strip.R: fansi:::process(" hello world\n ") [1] "hello world" 7/14 strip.R: fansi:::process("hello. ") [1] "hello." 7/14 strip.R: fansi:::process("hello! ") [1] "hello!" 7/14 strip.R: fansi:::process("hello? ") [1] "hello?" 7/14 strip.R: fansi:::process("hello? ") [1] "hello?" 7/14 strip.R: fansi:::process(" \t hello") [1] "hello" 7/14 strip.R: fansi:::process(" \t\a\r hello") [1] "\a\rhello" 7/14 strip.R: fansi:::process(" \t\a\r hello", ctl = c("all", "c0")) [1] "\a\r hello" 7/14 strip.R: fansi:::process("hello. \r world.") [1] "hello. \rworld." 7/14 strip.R: fansi:::process("hello. \033[31m world.\033[0m") [1] "hello. \033[31mworld.\033[0m" 7/14 strip.R: str1 <- c("hello ", " world") 7/14 strip.R: fansi:::process(str1) [1] "hello" "world" 7/14 strip.R: str1 [1] "hello " " world" 7/14 strip.R: fansi:::process("hello.\n\nworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\n\nworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\n\n\nworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n \nworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\t\nworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\t\n\tworld") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n \t \n \t world") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\nworld\n\n") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\nworld\n\n ") [1] "hello.\n\nworld" 7/14 strip.R: fansi:::process("\n\nhello.\n\t\n\tworld\n\t\n woohoo\n ") [1] "\n\nhello.\n\nworld\n\nwoohoo" 7/14 strip.R: fansi:::process("\n \t\nhello.\n\t\n\tworld\n\t\n woohoo\n ") [1] "\n\nhello.\n\nworld\n\nwoohoo" 7/14 strip.R: fansi:::process("hello.\n\033[44m\nworld") [1] "hello.\n\n\033[44mworld" 7/14 strip.R: fansi:::process("hello.\n\033[44m\n \t\nworld") [1] "hello.\n\n\033[44mworld" 7/14 strip.R: fansi:::process("hello.\033[44m\n\n \t\nworld") [1] "hello.\033[44m\n\nworld" 7/14 strip.R: fansi:::process("hello.\n\n \t\n\033[44mworld") [1] "hello.\n\n\033[44mworld" 7/14 strip.R: fansi:::process("hello.\n\n\033[44m \t\nworld") [1] "hello.\n\n\033[44mworld" 7/14 strip.R: fansi:::process("hello \033[44m world") [1] "hello \033[44mworld" 7/14 strip.R: fansi:::process("hello. \033[44m world") [1] "hello. \033[44mworld" 7/14 strip.R: fansi:::process("hello\033[44m\033[31m world") [1] "hello\033[44m\033[31m world" 7/14 strip.R: fansi:::process("hello\033[44m\033[31m\n\nworld") [1] "hello\033[44m\033[31m\n\nworld" 7/14 strip.R: fansi:::process("hello\n\033[44m\033[31m\nworld") [1] "hello\n\n\033[44m\033[31mworld" 7/14 strip.R: fansi:::process("hello\n\n\033[44m\033[31mworld") [1] "hello\n\n\033[44m\033[31mworld" 7/14 strip.R: fansi:::process("hello\033[44m\033[31d world") [1] "hello\033[44m\033[31d world" 7/14 strip.R: fansi:::process("hello \033[44m\033[31d world") [1] "hello \033[44m\033[31dworld" 7/14 strip.R: fansi:::process("hello \033[44m \033[31d world") [1] "hello \033[44m\033[31dworld" 7/14 strip.R: fansi:::process("hello\033[44m\033[31d world", ctl = c("all", [1] "hello\033[44m\033[31d world" 7/14 strip.R: fansi:::process("hello \033[44m\033[31d world", ctl = c("all", [1] "hello \033[44m\033[31d world" 7/14 strip.R: fansi:::process("hello \033[44m \033[31d world", ctl = c("all", [1] "hello \033[44m\033[31d world" 7/14 strip.R: fansi:::process("hello\033[44m\a world", ctl = c("all")) [1] "hello\033[44m\a world" 7/14 strip.R: fansi:::process("hello\033[44m\a world", ctl = c("all", "c0")) [1] "hello\033[44m\a world" 7/14 strip.R: fansi:::process("hello. \033[44m\a world", ctl = c("all")) [1] "hello. \033[44m\aworld" 7/14 strip.R: fansi:::process("hello. \033[44m\a world", ctl = c("all", "c0")) [1] "hello. \033[44m\a world" 7/14 strip.R: fansi:::process("hello. \033[44m \a world", ctl = c("all")) [1] "hello. \033[44m\aworld" 7/14 strip.R: fansi:::process("hello. \033[44m \a world", ctl = c("all", "c0")) [1] "hello. \033[44m\a world" 7/14 strip.R: fansi:::process("hello.\n\033[44m \a world", ctl = c("all")) [1] "hello. \033[44m\aworld" 7/14 strip.R: fansi:::process("hello.\n\033[44m \a world", ctl = c("all", "c0") [1] "hello. \033[44m\a world" 7/14 strip.R: fansi:::process("hello.\n\033[44m\n\a world", ctl = c("all")) [1] "hello.\n\n\033[44m\aworld" 7/14 strip.R: fansi:::process("hello.\n\033[44m\n\a world", ctl = c("all", [1] "hello.\n\n\033[44m\a world" 7/14 strip.R: fansi:::process("hello.\n\033[44m\a\n world", ctl = c("all")) [1] "hello.\n\n\033[44m\aworld" 7/14 strip.R: fansi:::process("hello.\n\033[44m\a\n world", ctl = c("all", [1] "hello. \033[44m\a world" 7/14 strip.R: unitizer_sect("Selective stripping", { 7/14 strip.R: string.0 <- "hello\033k\033[45p world\n\033[31mgoodbye\a moon" 7/14 strip.R: strip_ctl(string.0) [1] "hello worldgoodbye moon" 7/14 strip.R: strip_ctl(string.0, "sgr") [1] "hello\033k\033[45p world\ngoodbye\a moon" 7/14 strip.R: strip_ctl(string.0, c("nl", "c0", "sgr", "csi", "esc")) [1] "hello worldgoodbye moon" 7/14 strip.R: strip_ctl(string.0, "all") [1] "hello worldgoodbye moon" 7/14 strip.R: strip_ctl(string.0, c("c0", "esc")) [1] "hello45p world\n31mgoodbye moon" 7/14 strip.R: strip_ctl(string.0, c("nl")) [1] "hello\033k\033[45p world\033[31mgoodbye\a moon" 7/14 strip.R: strip_ctl(string.0, character()) [1] "hello\033k\033[45p world\n\033[31mgoodbye\a moon" 7/14 strip.R: strip_ctl(string.0, c("all", "c0", "esc")) [1] "hello\033k worldgoodbye\a moon" 7/14 strip.R: strip_ctl(string.0, c("all", "sgr")) [1] "hello world\033[31mgoodbye moon" 7/14 strip.R: string.1 <- "hello\033\033[45p world\n\033[31#3mgoodbye\a moon" 7/14 strip.R: strip_ctl(string.1, c("nl", "sgr", "esc")) Warning in strip_ctl(string.1, c("nl", "sgr", "esc")) : Argument `x` contains a malformed escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello[45p worldgoodbye\a moon" 7/14 strip.R: strip_ctl(string.1, c("csi")) [1] "hello\033 world\n\033[31#3mgoodbye\a moon" 7/14 strip.R: strip_ctl(string.1, "all") Warning in strip_ctl(string.1, "all") : Argument `x` contains a malformed escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello[45p worldgoodbye moon" 7/14 strip.R: strip_ctl(string.1, c("c0", "nl")) [1] "hello\033\033[45p world\033[31#3mgoodbye moon" 7/14 strip.R: strip_ctl(string.1, c("all", "sgr")) Warning in strip_ctl(string.1, c("all", "sgr")) : Argument `x` contains a malformed escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello[45p world\033[31#3mgoodbye moon" 7/14 strip.R: strip_sgr(string.1) [1] "hello\033\033[45p world\ngoodbye\a moon" 7/14 strip.R: strip_ctl(c(string.0, string.1, "hello"), warn = FALSE) [1] "hello worldgoodbye moon" "hello[45p worldgoodbye moon" [3] "hello" 7/14 strip.R: string.2 <- "\033k\033[45p\a\n\033[31mgoodbye moon" 7/14 strip.R: strip_ctl(string.2) [1] "goodbye moon" 7/14 strip.R: strip_ctl(string.2, "sgr") [1] "\033k\033[45p\a\ngoodbye moon" 7/14 strip.R: string.3 <- "hello world\033k\033[45p\a\n\033[31m" 7/14 strip.R: strip_ctl(string.3) [1] "hello world" 7/14 strip.R: strip_ctl(string.3, "sgr") [1] "hello world\033k\033[45p\a\n" 7/14 strip.R: unitizer_sect("Bad Inputs", { 7/14 strip.R: strip_ctl("hello\033[41mworld", warn = 1:3) Error in strip_ctl("hello\033[41mworld", warn = 1:3) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strip_ctl -> VAL_IN_ENV -> stop2 7/14 strip.R: strip_ctl("hello\033[41mworld", ctl = 1:3) Error in strip_ctl("hello\033[41mworld", ctl = 1:3) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> strip_ctl -> VAL_IN_ENV -> stop2 7/14 strip.R: strip_ctl("hello\033[41mworld", ctl = "bananas") Error in strip_ctl("hello\033[41mworld", ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> strip_ctl -> VAL_IN_ENV -> stop2 7/14 strip.R: strip_ctl("hello\033[41mworld", strip = "sgr") Parameter `strip` has been deprecated; use `ctl` instead. [1] "helloworld" 7/14 strip.R: strip_sgr("hello\033[41mworld", warn = 1:3) Error in strip_sgr("hello\033[41mworld", warn = 1:3) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strip_sgr -> VAL_IN_ENV -> stop2 8/14 strsplit.R: 8/14 strsplit.R: library(fansi) 8/14 strsplit.R: unitizer_sect("basic splits", { 8/14 strsplit.R: str.0 <- c("hello world", "goodbye moon") 8/14 strsplit.R: identical(strsplit(str.0[1], " "), strsplit_ctl(str.0[1], " ") [1] TRUE 8/14 strsplit.R: identical(strsplit(str.0, "h"), strsplit_ctl(str.0, "h")) [1] TRUE 8/14 strsplit.R: identical(strsplit(str.0, "m"), strsplit_ctl(str.0, "m")) [1] TRUE 8/14 strsplit.R: identical(strsplit(str.0, "g"), strsplit_ctl(str.0, "g")) [1] TRUE 8/14 strsplit.R: str.1 <- "hello\033[31m world" 8/14 strsplit.R: str.2 <- "\033[42m hello\033[m world, Goodbye Moon" 8/14 strsplit.R: strsplit_ctl(str.1, " ") [[1]] [1] "hello" "\033[31mworld\033[0m" 8/14 strsplit.R: strsplit_ctl(str.1, "hello") [[1]] [1] "" "\033[31m world\033[0m" 8/14 strsplit.R: strsplit_ctl(str.2, ", ") [[1]] [1] "\033[42m hello\033[m world" "Goodbye Moon" 8/14 strsplit.R: strsplit_ctl(c(str.1, "hello world", str.2), "hello") [[1]] [1] "" "\033[31m world\033[0m" [[2]] [1] "" " world" [[3]] [1] "\033[42m \033[0m" " world, Goodbye Moon" 8/14 strsplit.R: unitizer_sect("corner cases", { 8/14 strsplit.R: strsplit_ctl("hello\033[31m world", "") [[1]] [1] "h" "e" "l" "l" [5] "o" "\033[31m \033[0m" "\033[31mw\033[0m" "\033[31mo\033[0m" [9] "\033[31mr\033[0m" "\033[31ml\033[0m" "\033[31md\033[0m" 8/14 strsplit.R: strsplit_ctl("hello\033[31m world", "[", fixed = TRUE) [[1]] [1] "hello\033[31m world" 8/14 strsplit.R: strsplit_ctl("hello\033[31m world", NA_character_) Error in strsplit_ctl("hello\033[31m world", NA_character_) : Argument `split` may not contain NAs. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: strsplit_ctl("hello\033[31m world", character()) [[1]] [1] "h" "e" "l" "l" [5] "o" "\033[31m \033[0m" "\033[31mw\033[0m" "\033[31mo\033[0m" [9] "\033[31mr\033[0m" "\033[31ml\033[0m" "\033[31md\033[0m" 8/14 strsplit.R: strsplit_ctl("hello\033[31m world", letters) [[1]] [1] "hello\033[31m world" 8/14 strsplit.R: splits <- c("h", "e", "o", "llo", "x", "hello") 8/14 strsplit.R: str.spl1 <- strsplit_ctl(rep("hello", 6), splits) 8/14 strsplit.R: str.spl2 <- strsplit(rep("hello", 6), splits) 8/14 strsplit.R: identical(str.spl1, str.spl2) [1] TRUE 8/14 strsplit.R: str.spl3 <- strsplit_ctl(rep("\033[31mhello\033[39m", 6), spli 8/14 strsplit.R: str.spl3 [[1]] [1] "" "\033[31mello\033[0m" [[2]] [1] "\033[31mh\033[0m" "\033[31mllo\033[0m" [[3]] [1] "\033[31mhell\033[0m" [[4]] [1] "\033[31mhe\033[0m" [[5]] [1] "\033[31mhello\033[39m" [[6]] [1] "" 8/14 strsplit.R: identical(lapply(str.spl3, strip_ctl), str.spl2) [1] TRUE 8/14 strsplit.R: strsplit_ctl("", " ") [[1]] character(0) 8/14 strsplit.R: strsplit_ctl("", "") [[1]] character(0) 8/14 strsplit.R: strsplit_ctl(c("\033[31mab\033[0m", ""), "") [[1]] [1] "\033[31ma\033[0m" "\033[31mb\033[0m" [[2]] character(0) 8/14 strsplit.R: strsplit_ctl("hello", NULL) [[1]] [1] "h" "e" "l" "l" "o" 8/14 strsplit.R: str.sp14 <- c("\033[31mhello\nworld", "\ngoodbye\nmoon") 8/14 strsplit.R: strsplit_ctl(str.sp14, "\n") [[1]] [1] "\033[31mhello\nworld" [[2]] [1] "\ngoodbye\nmoon" 8/14 strsplit.R: strsplit_sgr(str.sp14, "\n") [[1]] [1] "\033[31mhello\033[0m" "\033[31mworld\033[0m" [[2]] [1] "" "goodbye" "moon" 8/14 strsplit.R: strsplit_ctl(str.sp14, "\n", ctl = c("all", "nl")) [[1]] [1] "\033[31mhello\033[0m" "\033[31mworld\033[0m" [[2]] [1] "" "goodbye" "moon" 8/14 strsplit.R: unitizer_sect("bad intputs", { 8/14 strsplit.R: str.bytes <- "\xde" 8/14 strsplit.R: Encoding(str.bytes) <- "bytes" 8/14 strsplit.R: strsplit_ctl(str.bytes, "") Error in strsplit_ctl(str.bytes, "") : Argument `x` contains a "bytes" encoded string at index [1], which is disallowed. Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl(str.2, NA) Error in strsplit_ctl(str.2, NA) : Argument `split` may not contain NAs. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: strsplit_ctl(str.2, "", warn = NULL) Error in strsplit_ctl(str.2, "", warn = NULL) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl(str.2, "", fixed = NA_integer_) Error in strsplit_ctl(str.2, "", fixed = NA_integer_) : Argument `fixed` must be TRUE or FALSE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: strsplit_ctl(str.2, "", perl = NA_integer_) Error in strsplit_ctl(str.2, "", perl = NA_integer_) : Argument `perl` must be TRUE or FALSE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: strsplit_ctl(str.2, "", useBytes = NA_integer_) Error in strsplit_ctl(str.2, "", useBytes = NA_integer_) : Argument `useBytes` must be TRUE or FALSE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: strsplit_ctl(str.2, "", term.cap = 1:3) Error in strsplit_ctl(str.2, "", term.cap = 1:3) : Argument `term.cap` must be character. Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl(str.2, "", term.cap = "bananas") Error in strsplit_ctl(str.2, "", term.cap = "bananas") : Argument `term.cap` may only contain values in c("all", "bright", "256", "truecolor", "old") Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl(str.2, "", ctl = 1:3) Error in strsplit_ctl(str.2, "", ctl = 1:3) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl(str.2, "", ctl = "bananas") Error in strsplit_ctl(str.2, "", ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> strsplit_ctl -> VAL_IN_ENV -> stop2 8/14 strsplit.R: strsplit_ctl("a b", str.bytes) Error in strsplit_ctl("a b", str.bytes) : Argument `split` may not be "bytes" encoded. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strsplit_ctl 8/14 strsplit.R: unitizer_sect("issue 55", { 8/14 strsplit.R: strsplit_ctl("hello\nworld", "\n") [[1]] [1] "hello\nworld" 8/14 strsplit.R: strsplit_sgr("hello\033[31mworld", "\033[31m", fixed = TRUE) [[1]] [1] "hello\033[31mworld" 8/14 strsplit.R: strsplit_ctl("a\nb", "\n", ctl = c("all", "nl")) [[1]] [1] "a" "b" 8/14 strsplit.R: strsplit_sgr("hello\nworld", "\n") [[1]] [1] "hello" "world" 9/14 substr.R: 9/14 substr.R: library(fansi) 9/14 substr.R: unitizer_sect("Simple", { 9/14 substr.R: str01 <- sprintf("hello %sworld%s how", red, inv) 9/14 substr.R: substr_ctl(str01, 1, 7) [1] "hello \033[31mw\033[0m" 9/14 substr.R: substr_ctl(str01, 7, 11) [1] "\033[31mworld\033[0m" 9/14 substr.R: substr_ctl(str01, 8, 10) [1] "\033[31morl\033[0m" 9/14 substr.R: substr_ctl(str01, 8, 14) [1] "\033[31morld\033[7m ho\033[0m" 9/14 substr.R: str02 <- sprintf("%shello world %sit's a %scrazy world%s out the 9/14 substr.R: term.cap <- c("bright", "256", "truecolor") 9/14 substr.R: substr_ctl(str02, 1, 7) [1] "\033[42mhello w\033[0m" 9/14 substr.R: substr_ctl(str02, 10, 20) [1] "\033[42mld \033[31mit's a \033[0mc" 9/14 substr.R: substr_ctl(str02, 15, 40, term.cap = term.cap) [1] "\033[31;42m's a \033[0mcrazy world\033[4;38;2;0;120;200m out there\033[0m" 9/14 substr.R: substr_ctl(str02, 35, 60, term.cap = term.cap) [1] "\033[4;38;2;0;120;200m there \033[7misn't it\033[0m\033[48;5;141m right?\033[0m" 9/14 substr.R: str03 <- sprintf("hello %sworld", rgb.und) 9/14 substr.R: substr_ctl(str03, 1, 12, term.cap = term.cap) [1] "hello \033[4;38;2;0;120;200mworld\033[0m" 9/14 substr.R: str04 <- sprintf("hello%s%s world%s%s yowza", red, inv, grn.bg, 9/14 substr.R: substr_ctl(str04, 5, 7, term.cap = term.cap) [1] "o\033[31m\033[7m w\033[0m" 9/14 substr.R: substr_ctl(str04, 5, 13, term.cap = term.cap) [1] "o\033[31m\033[7m world\033[42m\033[4;38;2;0;120;200m y\033[0m" 9/14 substr.R: unitizer_sect("Multi-line", { 9/14 substr.R: str.m.0 <- paste0("\033[44m", c("hello world", rep("goodbye \033 9/14 substr.R: substr_ctl(str.m.0, (1:4) * 2, (3:8) * 2) [1] "\033[44mello \033[0m" "\033[44mdbye \033[0m" [3] "\033[44mye \033[45mmo\033[0m" "\033[44mombas\033[0m" 9/14 substr.R: unitizer_sect("tabs", { 9/14 substr.R: substr2_ctl("yo\tworld", 1, 8, tabs.as.spaces = TRUE) [1] "yo " 9/14 substr.R: unitizer_sect("Corner cases", { 9/14 substr.R: substr_ctl("hello", 0, -1) [1] "" 9/14 substr.R: substr_ctl("hello", 0, 0) [1] "" 9/14 substr.R: substr_ctl(rep("hello", 2), c(1, 0), c(1, 1)) [1] "h" "h" 9/14 substr.R: substr_ctl(character(), 1, 1) character(0) 9/14 substr.R: substr_ctl(list("hello", list("goodbye", "there")), 1, 2) [1] "he" "li" 9/14 substr.R: substr_ctl(structure(list(list("goodbye", "there")), class = "fo [1] "li" 9/14 substr.R: str.0 <- "\033[31mred\033[m" 9/14 substr.R: str.1 <- "\033[31mred\033[42m" 9/14 substr.R: str.2 <- c(str.0, str.1) 9/14 substr.R: substr_ctl(str.2, 0, 0) [1] "" "" 9/14 substr.R: substr_ctl(str.2, 1, 1) [1] "\033[31mr\033[0m" "\033[31mr\033[0m" 9/14 substr.R: substr_ctl(str.2, 3, 3) [1] "\033[31md\033[0m" "\033[31md\033[0m" 9/14 substr.R: substr_ctl(str.2, 4, 4) [1] "" "" 9/14 substr.R: substr_ctl(str.2, 3, 4) [1] "\033[31md\033[0m" "\033[31md\033[0m" 9/14 substr.R: substr_ctl(str.2, 3, 5) [1] "\033[31md\033[0m" "\033[31md\033[0m" 9/14 substr.R: substr_ctl(str.2, 3, 4, terminate = FALSE) [1] "\033[31md\033[m" "\033[31md\033[42m" 9/14 substr.R: substr_ctl(str.2, 3, 5, terminate = FALSE) [1] "\033[31md\033[m" "\033[31md\033[42m" 9/14 substr.R: substr_ctl(str.2, -1, 2) [1] "\033[31mre\033[0m" "\033[31mre\033[0m" 9/14 substr.R: substr_ctl(str.2, -2, -1) [1] "" "" 9/14 substr.R: substr_ctl(str.2, 4, 1) [1] "" "" 9/14 substr.R: substr_ctl(str.2, 4, 1, terminate = FALSE) [1] "" "" 9/14 substr.R: substr_ctl(str.2, 4, 1, carry = "\033[44m") [1] "" "" 9/14 substr.R: substr_ctl(str.2, 4, 1, carry = "\033[44m", terminate = FALSE) [1] "" "" 9/14 substr.R: substr_ctl("hello", 5, 5) [1] "o" 9/14 substr.R: substr_ctl("hello", 6, 6) [1] "" 9/14 substr.R: substr_ctl("hello", 7, 6) [1] "" 9/14 substr.R: substr_ctl("hello", 6, 7) [1] "" 9/14 substr.R: substr_ctl("hello", 7, 5) [1] "" 9/14 substr.R: substr_ctl("hello", 0, 6) [1] "hello" 9/14 substr.R: substr_ctl("hello", 0, 5) [1] "hello" 9/14 substr.R: substr_ctl("hello", 1, 6) [1] "hello" 9/14 substr.R: substr_ctl("hello", "1", 1) [1] "h" 9/14 substr.R: substr_ctl("hello", 1, "1") [1] "h" 9/14 substr.R: substr_ctl("hello", "a", "b") Warning in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : NAs introduced by coercion Warning in substr2_ctl(x = x, start = start, stop = stop, warn = warn, term.cap = term.cap, : NAs introduced by coercion [1] NA 9/14 substr.R: substr_ctl("hello", 1, NA_integer_) [1] NA 9/14 substr.R: substr_ctl("hello", NA_integer_, 1) [1] NA 9/14 substr.R: substr_ctl(rep("\033[31mhello\033[m", 3), c(3, 2, 1), c(3, 4, [1] "\033[31ml\033[0m" "\033[31mell\033[0m" "\033[31mhello\033[0m" 9/14 substr.R: str.3 <- structure("fu\033[42mba\033[0mr", class = "foo", at = " 9/14 substr.R: substr_ctl(str.3, 2, 3) [1] "u\033[42mb\033[0m" attr(,"class") [1] "foo" attr(,"at") [1] "bar" 9/14 substr.R: substr_ctl(str.2, 2, 6, ctl = c("all", "sgr")) [1] "[31mr" "[31mr" 9/14 substr.R: substr_ctl(str.2, 8, 10, ctl = c("all", "sgr")) [1] "d\033[" "d\033[" 9/14 substr.R: substr2_ctl(rep("o\033[31m ", 2), 1:2, 1:2) [1] "o" "\033[31m \033[0m" 9/14 substr.R: substr_ctl("hello\033[41b", 1, 5) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" 9/14 substr.R: substr_ctl("hello\033[41b", 1, 6) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello\033[41b" 9/14 substr.R: substr_ctl("\033[1p\033[31mA", 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[31mA\033[0m" 9/14 substr.R: substr_ctl("\033[1p\033[31mA", 0, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[1p\033[31mA\033[0m" 9/14 substr.R: substr_ctl("\033[1p\033[31mA", -1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[1p\033[31mA\033[0m" 9/14 substr.R: substr_ctl("\033[31m\033[1pA", 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[31mA\033[0m" 9/14 substr.R: substr_ctl("\033[31m\033[1pA", 0, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[31m\033[1pA\033[0m" 9/14 substr.R: substr_ctl("\033[31m\033[1pA", -1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[31m\033[1pA\033[0m" 9/14 substr.R: substr_ctl("\033[41m\033[1mA", 1, 1) [1] "\033[1;41mA\033[0m" 9/14 substr.R: substr_ctl("\033[41m\033[1mA", 0, 1) [1] "\033[1;41mA\033[0m" 9/14 substr.R: substr_ctl("\033[41m\033[1mA", -1, 1) [1] "\033[1;41mA\033[0m" 9/14 substr.R: str.4 <- c("A\033[45mB", "A") 9/14 substr.R: substr_ctl(str.4, 1, 1, carry = TRUE, terminate = FALSE) [1] "A" "\033[45mA" 9/14 substr.R: substr_ctl("a\033[42", 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 9/14 substr.R: substr_ctl("a\033[42", 1, 2) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[42" 9/14 substr.R: substr_ctl("a\033[42", 1, 2, terminate = FALSE) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[42" 9/14 substr.R: substr_ctl("a\033]8;;END", 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 9/14 substr.R: substr_ctl("a\033]8;;END", 1, 2) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 9/14 substr.R: substr_ctl("a\033]8;;END", 1, 2, terminate = FALSE) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033]8;;END" 9/14 substr.R: substr_ctl("a\033];;END", 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 9/14 substr.R: substr_ctl("a\033];;END", 1, 2) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033];;END" 9/14 substr.R: substr_ctl("a\033[38;5mb", 1, 2, term.cap = "all") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[38;5mb" 9/14 substr.R: substr_ctl("a\033[38;2mb", 1, 2, term.cap = "all") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[38;2mb" 9/14 substr.R: substr_ctl("a\033[38;2;255mb", 1, 2, term.cap = "all") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[38;2;255mb" 9/14 substr.R: substr_ctl("a\033[38;2;255;255mb", 1, 2, term.cap = "all") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033[38;2;255;255mb" 9/14 substr.R: substr_ctl("\033[45pA", 1, 1, warn = FALSE) [1] "A" 9/14 substr.R: substr_ctl("\033[45pA", 0, 1, warn = FALSE) [1] "\033[45pA" 9/14 substr.R: substr_ctl(c("AB", NA, "CD"), 1, 2) [1] "AB" NA "CD" 9/14 substr.R: substr_ctl(c("AB", NA, "CD"), 1, 2, carry = TRUE) [1] "AB" NA NA 9/14 substr.R: substr_ctl(c("AB", "CD"), c(NA, 1), 2) [1] NA "CD" 9/14 substr.R: substr_ctl(c("AB", "CD"), c(NA, 1), 2, carry = TRUE) [1] NA "CD" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = "bright") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[38;5;4mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = c("bright", "old")) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[4;5mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = c("all", "256")) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[38;5;4mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = c("all", "256", Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[4;5mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = c("256")) [1] "\033[38;5;4mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;5;4mA", 1, 1, term.cap = c("256", "old")) [1] "\033[38;5;4mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = "bright") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[38;2;1;1;1mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = c("bright", Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[1;2mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = c("all", "truec Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[38;2;1;1;1mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = c("all", "truec Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[1;2mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = c("truecolor")) [1] "\033[38;2;1;1;1mA\033[0m" 9/14 substr.R: substr_ctl("\033[38;2;1;1;1mA", 1, 1, term.cap = c("truecolor", [1] "\033[38;2;1;1;1mA\033[0m" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = "256") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[107mA\033[0m" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = c("256", "old")) [1] "A" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = c("all", "bright")) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[107mA\033[0m" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = c("all", "bright", [1] "A" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = c("bright")) [1] "\033[107mA\033[0m" 9/14 substr.R: substr_ctl("\033[107mA", 1, 1, term.cap = c("bright", "old")) [1] "\033[107mA\033[0m" 9/14 substr.R: str.5 <- c("\033[48;2;100;100;100mAB", "\033[48;2;100;100;100mCD 9/14 substr.R: substr_ctl(str.5, 2, 2, terminate = FALSE, carry = TRUE, term.ca [1] "\033[48;2;100;100;100mB" "D" 9/14 substr.R: str.5a <- c("\033[48;2;100;100;100mAB", "\033[48;2;100;100;101mC 9/14 substr.R: substr_ctl(str.5a, 2, 2, terminate = FALSE, carry = TRUE, term.c [1] "\033[48;2;100;100;100mB" "\033[48;2;100;100;101mD" 9/14 substr.R: unitizer_sect("Obscure escapes", { 9/14 substr.R: tryCatch(substr_ctl("\033[38;6;31mworld\033[m", 2, 3), warning = [1] "Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: suppressWarnings(substr_ctl("\033[38;6;31mworld\033[m", 2, 3)) [1] "\033[6;31mor\033[0m" 9/14 substr.R: tryCatch(substr_ctl("\033[31mhello\033[38;5;256m world\033[m", [1] "Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: suppressWarnings(substr_ctl("\033[31mhello\033[38;5;256m world\0 [1] "\033[31mwo\033[0m" 9/14 substr.R: substr_ctl("\033[20mworld\033[m", 2, 3) [1] "\033[20mor\033[0m" 9/14 substr.R: substr_ctl("\033[21mworld\033[m", 2, 3) [1] "\033[21mor\033[0m" 9/14 substr.R: substr_ctl(rep("\033[26mhello \033[50mworld\033[m", 2), c(2, [1] "\033[26mel\033[0m" "orl" 9/14 substr.R: substr_ctl(rep("\033[61mwor\033[65mld\033[m", 2), c(2, 4), c(3, [1] "\033[61mor\033[0m" "ld" 9/14 substr.R: tryCatch(substr_ctl("\033[56mworld\033[m", 2, 3), warning = cond [1] "Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: suppressWarnings(substr_ctl("\033[56mworld\033[m", 2, 3)) [1] "or" 9/14 substr.R: tryCatch(substr_ctl("\033[66mworld\033[m", 2, 3), warning = cond [1] "Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: tryCatch(substr_ctl("\033[200mworld\033[m", 2, 3), warning = con [1] "Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: substr_ctl(rep("\033[91mwor\033[101mld\033[m", 2), c(2, 4), c(3, [1] "\033[91mor\033[0m" "\033[91;101mld\033[0m" 9/14 substr.R: unitizer_sect("bad args", { 9/14 substr.R: hello2.0 <- "\033[42m\thello world\033[m foobar" 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, warn = NULL) Error in substr2_ctl(hello2.0, 1, 2, warn = NULL) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, tabs.as.spaces = 1) [1] "\033[42m \033[0m" 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, tabs.as.spaces = NA) Error in substr2_ctl(hello2.0, 1, 2, tabs.as.spaces = NA) : Argument `tabs.as.spaces` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, tab.stops = -(1:3)) Error in substr2_ctl(hello2.0, 1, 2, tab.stops = -(1:3)) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, tab.stops = 0) Error in substr2_ctl(hello2.0, 1, 2, tab.stops = 0) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, round = "bananas") Error in substr2_ctl(hello2.0, 1, 2, round = "bananas") : Argument `round` must partial match one of c("start", "stop", "both", "neither") Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, term.cap = 0) Error in substr2_ctl(hello2.0, 1, 2, term.cap = 0) : Argument `term.cap` must be character. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, term.cap = "bananas") Error in substr2_ctl(hello2.0, 1, 2, term.cap = "bananas") : Argument `term.cap` may only contain values in c("all", "bright", "256", "truecolor", "old") Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, type = "bananas") Error in substr2_ctl(hello2.0, 1, 2, type = "bananas") : Argument `type` must partial match one of c("chars", "width", "graphemes") Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, ctl = "bananas") Error in substr2_ctl(hello2.0, 1, 2, ctl = "bananas") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: substr2_ctl(hello2.0, 1, 2, ctl = 0) Error in substr2_ctl(hello2.0, 1, 2, ctl = 0) : Argument `ctl` must be character. Calls: unitize_dir ... eval -> withVisible -> substr2_ctl -> VAL_IN_ENV -> stop2 9/14 substr.R: unitizer_sect("`ctl` related issues", { 9/14 substr.R: substr_sgr("\033[31;42mhello world", 2, 4) [1] "\033[31;42mell\033[0m" 9/14 substr.R: substr_sgr("\033[31m\033[42mhello world", 2, 4) [1] "\033[31;42mell\033[0m" 9/14 substr.R: tryCatch(substr_sgr("\033[31;42!mhello world", 2, 4), warning = [1] "Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 9/14 substr.R: substr_sgr("\033[55;38l\033[31mhello world", 2, 4, warn = FALSE) [1] "[55" 9/14 substr.R: substr_sgr("\033[31m\033[55;38lhello world", 2, 4, warn = FALSE) [1] "\033[31m[55\033[0m" 9/14 substr.R: substr_sgr("hello \033[31m\033[55;38lworld", 7, 9, warn = FALSE) [1] "\033[31m\033[5\033[0m" 9/14 substr.R: substr_ctl("\033[55;38l\033[31mhello world", 2, 4, warn = FALSE) [1] "\033[31mell\033[0m" 9/14 substr.R: substr_ctl("\033[31m\033[55;38lhello world", 2, 4, warn = FALSE) [1] "\033[31mell\033[0m" 9/14 substr.R: substr_ctl("hello \033[31m\033[55;38lworld", 7, 9, warn = FALSE) [1] "\033[31mwor\033[0m" 9/14 substr.R: substr_ctl("hello\033[55;38l \033[31mworld", 4, 7, warn = FALSE) [1] "lo\033[55;38l \033[31mw\033[0m" 9/14 substr.R: substr_sgr("ab\n\tcd\n", 3, 6, warn = FALSE) [1] "\n\tcd" 9/14 substr.R: substr_sgr("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE) [1] "\n\033[31m\tcd\033[0m" 9/14 substr.R: substr_ctl("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE, ctl = c("al [1] "\n\033[31m\tcd\n\033[0m" 9/14 substr.R: substr_ctl("ab\n\033[31m\tcd\n", 3, 6, warn = FALSE, ctl = c("al [1] "\n\033[31m\tcd\033[0m" 9/14 substr.R: substr_sgr(c("\a", "b", "c"), 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\a" "b" "c" 9/14 substr.R: substr_sgr(c("a", "\b", "c"), 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" "\b" "c" 9/14 substr.R: substr_sgr(c("a", "b", "\ac"), 1, 1) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [3], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" "b" "\a" 9/14 substr.R: unitizer_sect("Rep Funs - Equivalence", { 9/14 substr.R: txt0 <- "ABCD" 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 2, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 2, value = "#?"), `substr<-`(t [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 3, value = "#?-"), `substr<-`( [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 0, 0, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 1, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 10, 12, value = "#"), `substr<-`( [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 3, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 1, 5, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 0, 5, value = "#"), `substr<-`(tx [1] TRUE 9/14 substr.R: `substr_ctl<-`(txt0, 0, -1, value = "#") [1] "ABCD" 9/14 substr.R: rep1 <- c("_", "_.") 9/14 substr.R: rep2 <- c("_", "_.", "...") 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 3, value = rep1), `substr<-`(t [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 3, value = rep2), `substr<-`(t [1] TRUE 9/14 substr.R: txt1 <- c("AB", "CDE") 9/14 substr.R: identical(`substr_ctl<-`(txt1, 2, 3, value = "_"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt1, 2, 3, value = rep1), `substr<-`(t [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt1, 2, 3, value = rep2), `substr<-`(t [1] TRUE 9/14 substr.R: txt2 <- c("AB", "CDE", "EFGH") 9/14 substr.R: identical(`substr_ctl<-`(txt2, 2, 3, value = "_"), `substr<-`(tx [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt2, 2, 3, value = rep1), `substr<-`(t [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt2, 2, 3, value = rep2), `substr<-`(t [1] TRUE 9/14 substr.R: txt3a <- txt3b <- c("ABC", "ABC") 9/14 substr.R: substr(txt3a[2], 2, 2) <- "_" 9/14 substr.R: substr_ctl(txt3b[2], 2, 2) <- "_" 9/14 substr.R: identical(txt3a, txt3b) [1] TRUE 9/14 substr.R: identical(`substr_ctl<-`(txt0, 2, 3, value = NA_character_), [1] TRUE 9/14 substr.R: txt.na <- NA_character_ 9/14 substr.R: identical(`substr_ctl<-`(txt.na, 1, 2, value = "AB"), `substr<-` [1] TRUE 9/14 substr.R: unitizer_sect("Rep Funs - SGR", { 9/14 substr.R: txt1 <- "\033[33mABCD" 9/14 substr.R: txt2 <- "\033[33mA\033[44mBCD" 9/14 substr.R: txt3 <- "\033[33mA\033[44mBC\033[1mD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 2, value = "#") [1] "\033[33mA\033[0m#\033[33mCD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, value = "#?-") [1] "\033[33mA\033[0m#?\033[33mD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, value = "#\033[32m?-") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[33mD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, value = "#\033[32m?-\033[0m") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[33mD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, value = "#\033[0m?-") [1] "\033[33mA\033[0m#\033[0m?\033[33mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, value = "#\033[32m?-") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[33;44mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, value = "#\033[32m?-\033[0m") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[33;44mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, value = "#\033[0m?-") [1] "\033[33mA\033[0m#\033[0m?\033[33;44mD" 9/14 substr.R: `substr_ctl<-`(txt3, 2, 3, value = "#\033[32m?-") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[1;33;44mD" 9/14 substr.R: `substr_ctl<-`(txt3, 2, 3, value = "#\033[32m?-\033[0m") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[1;33;44mD" 9/14 substr.R: `substr_ctl<-`(txt3, 2, 3, value = "#\033[0m?-") [1] "\033[33mA\033[0m#\033[0m?\033[1;33;44mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 2, terminate = FALSE, value = "#") [1] "\033[33mA#\033[44mCD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, terminate = FALSE, value = "#\033[32m [1] "\033[33mA#\033[32m?\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, terminate = FALSE, value = "#\033[32m [1] "\033[33mA#\033[32m?\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt2, 2, 3, terminate = FALSE, value = "#\033[0m? [1] "\033[33mA#\033[0m?\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, terminate = FALSE, value = "#\033[0m? [1] "\033[33mA#\033[0m?D" 9/14 substr.R: `substr_ctl<-`(txt1, 2, 3, terminate = FALSE, value = "#\033[0m\ [1] "\033[33mA#\033[0m\033[45m?D" 9/14 substr.R: txt4 <- c(txt2, txt0, "\033[39mABCD") 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, value = "#") [1] "\033[33mA\033[0m#\033[33;44mCD" "A#CD" [3] "\033[39mA#CD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, value = c("#", "?")) [1] "\033[33mA\033[0m#\033[33;44mCD" "A?CD" [3] "\033[39mA#CD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, value = c("#", "?", "$")) [1] "\033[33mA\033[0m#\033[33;44mCD" "A?CD" [3] "\033[39mA$CD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 2, carry = TRUE, value = "#") [1] "\033[33mA\033[0m#\033[33;44mCD" "A\033[0m#\033[33;44mCD" [3] "\033[39mA\033[0m#\033[44mCD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, carry = TRUE, value = "#\033[32m?-") [1] "\033[33mA\033[0m#\033[32m?\033[0m\033[33;44mD" [2] "A\033[0m\033[32m#\033[32m?\033[0m\033[33;44mD" [3] "\033[39mA\033[0m\033[32m#\033[32m?\033[0m\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, carry = TRUE, value = "#\033[42m?-\03 [1] "\033[33mA\033[0m#\033[42m?\033[0m\033[33;44mD" [2] "A\033[0m#\033[42m?\033[0m\033[33;44mD" [3] "\033[39mA\033[0m#\033[42m?\033[0m\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, carry = TRUE, value = "#\033[0m?-") [1] "\033[33mA\033[0m#\033[0m?\033[33;44mD" [2] "A\033[0m#\033[0m?\033[33;44mD" [3] "\033[39mA\033[0m#\033[0m?\033[44mD" 9/14 substr.R: rep4 <- c("\033[32m_\033[45m", ".-", "\033[39m__") 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, carry = TRUE, value = rep4) [1] "\033[33mA\033[0m\033[32m_\033[0m\033[33;44mCD" [2] "A\033[0m\033[32;45m.-\033[0m\033[33;44mD" [3] "\033[39mA\033[0m\033[45m__\033[0m\033[44mD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 2, terminate = FALSE, carry = TRUE, valu [1] "\033[33mA#\033[44mCD" "A#CD" "\033[39mA#CD" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, terminate = FALSE, carry = TRUE, valu [1] "\033[33mA#\033[32m?\033[44mD" "A#\033[32m?D" [3] "\033[39mA#\033[32m?D" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, terminate = FALSE, carry = TRUE, valu [1] "\033[33mA#\033[35m?\033[44mD" "A\033[0m#\033[35m?D" [3] "\033[39mA\033[0m#\033[35m?D" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, terminate = FALSE, carry = TRUE, valu [1] "\033[33mA#\033[0m?\033[44mD" "A#\033[0m?D" [3] "\033[39mA#\033[0m?D" 9/14 substr.R: `substr_ctl<-`(txt4, 2, 3, terminate = FALSE, carry = TRUE, valu [1] "\033[33mA\033[32m_\033[45m\033[44mCD" [2] "A.-D" [3] "\033[39mA\033[0;45m__D" 9/14 substr.R: txt5 <- c("ABD", "DFG") 9/14 substr.R: `substr_ctl<-`(txt5, 2, 2, value = ".\033[45m", carry = TRUE, [1] "A.D" "D\033[45m.G" 9/14 substr.R: txt6 <- "A123456789B" 9/14 substr.R: `substr2_ctl<-`(txt6, 2, 9, value = "\t", tabs.as.spaces = TRUE) [1] "A 9B" 9/14 substr.R: `substr2_ctl<-`(txt6, 2, 3, value = "\t", tabs.as.spaces = TRUE) [1] "A 3456789B" 9/14 substr.R: `substr2_ctl<-`(txt6, 2, 10, value = "\t", tabs.as.spaces = TRUE [1] "A 9B" 9/14 substr.R: txt7a <- "Šos" 9/14 substr.R: txt7b <- "sos" 9/14 substr.R: txt7c <- "soŠ" 9/14 substr.R: val.scar <- "š" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7a, 1, 1, value = val.scar)) [1] "UTF-8" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7a, 1, 1, value = "s")) [1] "unknown" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7a, 2, 2, value = val.scar)) [1] "UTF-8" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7a, 2, 2, value = "s")) [1] "UTF-8" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7b, 2, 2, value = val.scar)) [1] "UTF-8" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7b, 2, 2, value = "s")) [1] "unknown" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7c, 3, 3, value = val.scar)) [1] "UTF-8" 9/14 substr.R: Encoding(`substr_ctl<-`(txt7c, 3, 3, value = "s")) [1] "unknown" 9/14 substr.R: unitizer_sect("Rep Funs - Corner Cases", { 9/14 substr.R: `substr_ctl<-`(txt2, 1, 3, terminate = FALSE, value = "#\033[32m [1] "\033[33m#\033[32m?\033[0m\033[44mCD" 9/14 substr.R: txt8 <- "\033[32mAB\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 2, value = "12") [1] "\033[32m\033[0m12\033[32m\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 2, value = "12", terminate = FALSE) [1] "\033[32m12\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 3, value = "12") [1] "\033[32m\033[0m12" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 3, value = "1") [1] "\033[32m\033[0m1\033[32mB\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 3, value = "") [1] "\033[32mAB\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 3, value = "123") [1] "\033[32m\033[0m12" 9/14 substr.R: `substr_ctl<-`(txt8, 0, 2, value = "12") [1] "12\033[32m\033[45m" 9/14 substr.R: `substr_ctl<-`(txt8, 0, 3, value = "12") [1] "12" 9/14 substr.R: `substr_ctl<-`(txt8, 1, 3, value = "\033[1m", terminate = FALSE) [1] "\033[32m\033[1mAB\033[45m" 9/14 substr.R: tce(`substr_ctl<-`(txt8, 1, 3, value = "A", carry = "\033[41m")) [1] "Argument `carry` must be TRUE or FALSE in replacement mode." 9/14 substr.R: lat <- "fa\xe7ile" 9/14 substr.R: Encoding(lat) <- "latin1" 9/14 substr.R: tce(`substr_ctl<-`(lat, 1, 3, value = "ABC")) [1] "`x` may only contain ASCII or marked UTF-8 encoded strings; you can use `enc2utf8` to convert `x` prior to use with `substr_ctl<-` (replacement form). Illegal value at position [1]." 9/14 substr.R: txt.na2 <- c("AB", NA, "BC") 9/14 substr.R: `substr_ctl<-`(txt.na2, 1, 1, value = "#") [1] "#B" NA "#C" 9/14 substr.R: txt.nona <- c("AB", "BC", "CD") 9/14 substr.R: `substr_ctl<-`(txt.nona, 1, 1, value = c("#", NA), carry = TRUE) [1] "#B" NA NA 10/14 tabs.R: 10/14 tabs.R: library(unitizer) 10/14 tabs.R: library(fansi) 10/14 tabs.R: unitizer_sect("simple tabs", { 10/14 tabs.R: string <- "1\t12\t123\t1234\t12345678" 10/14 tabs.R: tabs_as_spaces(string) [1] "1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces(string, c(2, 3, 4, 5, 8)) [1] "1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces(string, c(2, 8)) [1] "1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces(1:3) [1] "1" "2" "3" 10/14 tabs.R: unitizer_sect("newlines", { 10/14 tabs.R: string.n <- paste0("1\t12\t123\t1234\t12345678\n", "1\t12\t123\t12 10/14 tabs.R: tabs_as_spaces(string.n) [1] "1 12 123 1234 12345678\n1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces(string.n, c(2, 3, 4, 8)) [1] "1 12 123 1234 12345678\n1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces(string.n, c(2, 8)) [1] "1 12 123 1234 12345678\n1 12 123 1234 12345678" 10/14 tabs.R: unitizer_sect("corner cases", { 10/14 tabs.R: tabs_as_spaces("") [1] "" 10/14 tabs.R: tabs_as_spaces("\t") [1] " " 10/14 tabs.R: tabs_as_spaces("\n") [1] "\n" 10/14 tabs.R: tabs_as_spaces(c(string, string, string)) [1] "1 12 123 1234 12345678" [2] "1 12 123 1234 12345678" [3] "1 12 123 1234 12345678" 10/14 tabs.R: tabs_as_spaces("\t\t") [1] " " 10/14 tabs.R: unitizer_sect("bad inputs", { 10/14 tabs.R: tabs_as_spaces(string, warn = 1:3) Error in tabs_as_spaces(string, warn = 1:3) : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> tabs_as_spaces -> VAL_IN_ENV -> stop2 10/14 tabs.R: tabs_as_spaces(string, tab.stops = "hello") Error in tabs_as_spaces(string, tab.stops = "hello") : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... withVisible -> tabs_as_spaces -> VAL_IN_ENV -> stop2 10/14 tabs.R: tabs_as_spaces(string, ctl = "hello") Error in tabs_as_spaces(string, ctl = "hello") : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... withVisible -> tabs_as_spaces -> VAL_IN_ENV -> stop2 10/14 tabs.R: tabs_as_spaces(string, ctl = 0) Error in tabs_as_spaces(string, ctl = 0) : Argument `ctl` must be character. Calls: unitize_dir ... withVisible -> tabs_as_spaces -> VAL_IN_ENV -> stop2 11/14 tohtml.R: 11/14 tohtml.R: library(unitizer) 11/14 tohtml.R: library(fansi) 11/14 tohtml.R: unitizer_sect("colors", { 11/14 tohtml.R: style <- "width: 16px; height: 16px; display: inline-block;" 11/14 tohtml.R: span <- "" 11/14 tohtml.R: colors.8 <- fansi:::esc_color_code_to_html(rbind(c(0:7), 0L, 11/14 tohtml.R: colors.8 [1] "#000000" "#BB0000" "#00BB00" "#BBBB00" "#0000BB" "#BB00BB" "#00BBBB" [8] "#BBBBBB" 11/14 tohtml.R: fansi:::esc_color_code_to_html(matrix(c(9L, 0L, 0L, 0L, 0L))) Error in fansi:::esc_color_code_to_html(matrix(c(9L, 0L, 0L, 0L, 0L))) : Internal Error: applying non-color. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 11/14 tohtml.R: colors.255 <- fansi:::esc_color_code_to_html(rbind(8L, 5L, 0:255 11/14 tohtml.R: colors.255 [1] "#000000" "#800000" "#008000" "#808000" "#000080" "#800080" "#008080" [8] "#C0C0C0" "#808080" "#FF0000" "#00FF00" "#FFFF00" "#0000FF" "#FF00FF" [15] "#00FFFF" "#FFFFFF" "#000000" "#00005F" "#000087" "#0000AF" "#0000D7" [22] "#0000FF" "#005F00" "#005F5F" "#005F87" "#005FAF" "#005FD7" "#005FFF" [29] "#008700" "#00875F" "#008787" "#0087AF" "#0087D7" "#0087FF" "#00AF00" [36] "#00AF5F" "#00AF87" "#00AFAF" "#00AFD7" "#00AFFF" "#00D700" "#00D75F" [43] "#00D787" "#00D7AF" "#00D7D7" "#00D7FF" "#00FF00" "#00FF5F" "#00FF87" [50] "#00FFAF" "#00FFD7" "#00FFFF" "#5F0000" "#5F005F" "#5F0087" "#5F00AF" [57] "#5F00D7" "#5F00FF" "#5F5F00" "#5F5F5F" "#5F5F87" "#5F5FAF" "#5F5FD7" [64] "#5F5FFF" "#5F8700" "#5F875F" "#5F8787" "#5F87AF" "#5F87D7" "#5F87FF" [71] "#5FAF00" "#5FAF5F" "#5FAF87" "#5FAFAF" "#5FAFD7" "#5FAFFF" "#5FD700" [78] "#5FD75F" "#5FD787" "#5FD7AF" "#5FD7D7" "#5FD7FF" "#5FFF00" "#5FFF5F" [85] "#5FFF87" "#5FFFAF" "#5FFFD7" "#5FFFFF" "#870000" "#87005F" "#870087" [92] "#8700AF" "#8700D7" "#8700FF" "#875F00" "#875F5F" "#875F87" "#875FAF" [99] "#875FD7" "#875FFF" "#878700" "#87875F" "#878787" "#8787AF" "#8787D7" [106] "#8787FF" "#87AF00" "#87AF5F" "#87AF87" "#87AFAF" "#87AFD7" "#87AFFF" [113] "#87D700" "#87D75F" "#87D787" "#87D7AF" "#87D7D7" "#87D7FF" "#87FF00" [120] "#87FF5F" "#87FF87" "#87FFAF" "#87FFD7" "#87FFFF" "#AF0000" "#AF005F" [127] "#AF0087" "#AF00AF" "#AF00D7" "#AF00FF" "#AF5F00" "#AF5F5F" "#AF5F87" [134] "#AF5FAF" "#AF5FD7" "#AF5FFF" "#AF8700" "#AF875F" "#AF8787" "#AF87AF" [141] "#AF87D7" "#AF87FF" "#AFAF00" "#AFAF5F" "#AFAF87" "#AFAFAF" "#AFAFD7" [148] "#AFAFFF" "#AFD700" "#AFD75F" "#AFD787" "#AFD7AF" "#AFD7D7" "#AFD7FF" [155] "#AFFF00" "#AFFF5F" "#AFFF87" "#AFFFAF" "#AFFFD7" "#AFFFFF" "#D70000" [162] "#D7005F" "#D70087" "#D700AF" "#D700D7" "#D700FF" "#D75F00" "#D75F5F" [169] "#D75F87" "#D75FAF" "#D75FD7" "#D75FFF" "#D78700" "#D7875F" "#D78787" [176] "#D787AF" "#D787D7" "#D787FF" "#D7AF00" "#D7AF5F" "#D7AF87" "#D7AFAF" [183] "#D7AFD7" "#D7AFFF" "#D7D700" "#D7D75F" "#D7D787" "#D7D7AF" "#D7D7D7" [190] "#D7D7FF" "#D7FF00" "#D7FF5F" "#D7FF87" "#D7FFAF" "#D7FFD7" "#D7FFFF" [197] "#FF0000" "#FF005F" "#FF0087" "#FF00AF" "#FF00D7" "#FF00FF" "#FF5F00" [204] "#FF5F5F" "#FF5F87" "#FF5FAF" "#FF5FD7" "#FF5FFF" "#FF8700" "#FF875F" [211] "#FF8787" "#FF87AF" "#FF87D7" "#FF87FF" "#FFAF00" "#FFAF5F" "#FFAF87" [218] "#FFAFAF" "#FFAFD7" "#FFAFFF" "#FFD700" "#FFD75F" "#FFD787" "#FFD7AF" [225] "#FFD7D7" "#FFD7FF" "#FFFF00" "#FFFF5F" "#FFFF87" "#FFFFAF" "#FFFFD7" [232] "#FFFFFF" "#080808" "#121212" "#1C1C1C" "#262626" "#303030" "#3A3A3A" [239] "#444444" "#4E4E4E" "#585858" "#626262" "#6C6C6C" "#767676" "#808080" [246] "#8A8A8A" "#949494" "#9E9E9E" "#A8A8A8" "#B2B2B2" "#BCBCBC" "#C6C6C6" [253] "#D0D0D0" "#DADADA" "#E4E4E4" "#EEEEEE" 11/14 tohtml.R: vals <- c(0L, 127L, 255L) 11/14 tohtml.R: colors.tru <- fansi:::esc_color_code_to_html(do.call(rbind, c(li 11/14 tohtml.R: colors.tru [1] "#000000" "#7F0000" "#FF0000" "#007F00" "#7F7F00" "#FF7F00" "#00FF00" [8] "#7FFF00" "#FFFF00" "#00007F" "#7F007F" "#FF007F" "#007F7F" "#7F7F7F" [15] "#FF7F7F" "#00FF7F" "#7FFF7F" "#FFFF7F" "#0000FF" "#7F00FF" "#FF00FF" [22] "#007FFF" "#7F7FFF" "#FF7FFF" "#00FFFF" "#7FFFFF" "#FFFFFF" 11/14 tohtml.R: unitizer_sect("simple html conversion", { 11/14 tohtml.R: as_html_page <- function(x) { 11/14 tohtml.R: sgr_to_html("hello \033[31;42;1mworld\033[0m") [1] "hello world" 11/14 tohtml.R: sgr_to_html("hello \033[31;48;5;23;1mworld\033[m") [1] "hello world" 11/14 tohtml.R: sgr_to_html("\033[1mbold\033[22m \033[2mfaint\033[22m \033[mital [1] "bold faint italic\n" 11/14 tohtml.R: csi_string <- c("\033[1mbold\033[22m \033[2mfaint\033[22m \033[3 11/14 tohtml.R: html_string <- sgr_to_html(csi_string) 11/14 tohtml.R: html_string [1] "bold faint italic" [2] "underline slow-blink" [3] "fast-blink" [4] "red-fg-green-bginverse inverse-off" [5] "conceal reveal crossed-outclear" [6] "bold faint italic" [7] "underline slow-blink" [8] "fast-blink" [9] "red-fg-green-bginverse inverse-off" [10] "conceal reveal crossed-outclear" [11] "italic again not italic?" 11/14 tohtml.R: unitizer_sect("Bright Colors", { 11/14 tohtml.R: sgr_to_html("hello\033[94;101m world\033[39m yow\033[49mza") [1] "hello world yowza" 11/14 tohtml.R: sgr_to_html("hello\033[98;101m world\033[39m yow\033[49mza") Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello world yowza" 11/14 tohtml.R: unitizer_sect("Corner cases", { 11/14 tohtml.R: sgr_to_html("hello\033[0m") [1] "hello" 11/14 tohtml.R: sgr_to_html("hello\033[31m") [1] "hello" 11/14 tohtml.R: sgrs <- paste0(rep("\033[31m", 20), collapse = "") 11/14 tohtml.R: sgr_to_html(sprintf("%shello world\033[m", sgrs)) [1] "hello world" 11/14 tohtml.R: sgr_to_html(1:3) [1] "1" "2" "3" 11/14 tohtml.R: sgr_to_html("\033[31mhello\033[m\033[42m world\033[m") [1] "hello world" 11/14 tohtml.R: sgr_to_html("\033[33mhello") [1] "hello" 11/14 tohtml.R: sgr_to_html("he\033[33mllo") [1] "hello" 11/14 tohtml.R: sgr_to_html("hello\033[33m") [1] "hello" 11/14 tohtml.R: sgr_to_html(c("\033[33mhello", "world")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("\033[33mhello", "\033[44mworld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("\033[33mhello", "wor\033[44mld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("\033[33mhello", "world\033[44m")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("he\033[33mllo", "world")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("he\033[33mllo", "\033[44mworld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("he\033[33mllo", "wor\033[44mld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("he\033[33mllo", "world\033[44m")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("hello\033[33m", "world")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("hello\033[33m", "\033[44mworld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("hello\033[33m", "wor\033[44mld")) [1] "hello" [2] "world" 11/14 tohtml.R: sgr_to_html(c("hello\033[33m", "world\033[44m")) [1] "hello" [2] "world" 11/14 tohtml.R: unitizer_sect("Bad inputs", { 11/14 tohtml.R: fansi:::esc_color_code_to_html(matrix(1:12, 4)) Error in fansi:::esc_color_code_to_html(matrix(1:12, 4)) : Argument `x` must be a five row integer matrix. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> 11/14 tohtml.R: sgr_to_html(1:3) [1] "1" "2" "3" 11/14 tohtml.R: sgr_to_html("a", warn = 1:3) Error in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> VAL_IN_ENV -> stop2 11/14 tohtml.R: sgr_to_html("a", term.cap = 1:3) Error in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `term.cap` must be character. Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> VAL_IN_ENV -> stop2 11/14 tohtml.R: sgr_to_html("a", term.cap = "hello") Error in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `term.cap` may only contain values in c("all", "bright", "256", "truecolor", "old") Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> VAL_IN_ENV -> stop2 11/14 tohtml.R: unitizer_sect("issue54", { 11/14 tohtml.R: string <- c("\033[31m", "\033[39m") 11/14 tohtml.R: fansi::sgr_to_html(string) [1] "" "" 11/14 tohtml.R: string1 <- c("\033[31mhello", "world\033[39m moon") 11/14 tohtml.R: fansi::sgr_to_html(string1) [1] "hello" [2] "world moon" 11/14 tohtml.R: string2 <- c("\033[3mhello\033[24m", "world\033[23m moon") 11/14 tohtml.R: fansi::sgr_to_html(string2) [1] "hello" [2] "world moon" 11/14 tohtml.R: unitizer_sect("Colors as classes (#65)", { 11/14 tohtml.R: sgr_to_html("\033[94mhello\033[31;42;1mworld\033[m", classes = T [1] "helloworld" 11/14 tohtml.R: class.8 <- do.call(paste, c(expand.grid(c("fg", "bg"), 0:7), 11/14 tohtml.R: class.16 <- do.call(paste, c(expand.grid(c("fg", "bg"), 0:15), 11/14 tohtml.R: class.256 <- do.call(paste, c(expand.grid(c("fg", "bg"), 0:255), 11/14 tohtml.R: x <- c("\033[94mhe\033[107mllo\033[31;42;1mworld\033[m", "\033[4 11/14 tohtml.R: term.cap <- c("bright", "256", "truecolor") 11/14 tohtml.R: sgr_to_html(x, classes = class.8, term.cap = term.cap) [1] "helloworld" [2] "goodbye super moon" 11/14 tohtml.R: sgr_to_html(x, classes = class.16, term.cap = term.cap) [1] "helloworld" [2] "goodbye super moon" 11/14 tohtml.R: sgr_to_html(x, classes = class.256, term.cap = term.cap) [1] "helloworld" [2] "goodbye super moon" 11/14 tohtml.R: make_styles(class.8) [1] ".fg-0 {color: #000000;}" ".bg-0 {background-color: #000000;}" [3] ".fg-1 {color: #800000;}" ".bg-1 {background-color: #800000;}" [5] ".fg-2 {color: #008000;}" ".bg-2 {background-color: #008000;}" [7] ".fg-3 {color: #808000;}" ".bg-3 {background-color: #808000;}" [9] ".fg-4 {color: #000080;}" ".bg-4 {background-color: #000080;}" [11] ".fg-5 {color: #800080;}" ".bg-5 {background-color: #800080;}" [13] ".fg-6 {color: #008080;}" ".bg-6 {background-color: #008080;}" [15] ".fg-7 {color: #C0C0C0;}" ".bg-7 {background-color: #C0C0C0;}" 11/14 tohtml.R: make_styles(class.8, matrix(c(0, 1, 0, 0, 0, 1, 1, 0, 0), 3)) [1] ".fg-0 {color: #000000;}" ".bg-0 {background-color: #000000;}" [3] ".fg-1 {color: #000080;}" ".bg-1 {background-color: #000080;}" [5] ".fg-2 {color: #800000;}" ".bg-2 {background-color: #800000;}" [7] ".fg-3 {color: #800080;}" ".bg-3 {background-color: #800080;}" [9] ".fg-4 {color: #008000;}" ".bg-4 {background-color: #008000;}" [11] ".fg-5 {color: #008080;}" ".bg-5 {background-color: #008080;}" [13] ".fg-6 {color: #808000;}" ".bg-6 {background-color: #808000;}" [15] ".fg-7 {color: #C0C0C0;}" ".bg-7 {background-color: #C0C0C0;}" 11/14 tohtml.R: sgr_to_html(sgr_256()) [1] "Standard" [2] " 0 1 2 3 4 5 6 7" [3] "" [4] "High-Intensity" [5] " 8 9 10 11 12 13 14 15" [6] "" [7] "216 Colors (Dark)" [8] " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33" [9] " 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69" [10] " 88 89 90 91 92 93 94 95 96 97 98 99100101102103104105" [11] "124125126127128129130131132133134135136137138139140141" [12] "160161162163164165166167168169170171172173174175176177" [13] "196197198199200201202203204205206207208209210211212213" [14] "" [15] "216 Colors (Light)" [16] " 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51" [17] " 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87" [18] "106107108109110111112113114115116117118119120121122123" [19] "142143144145146147148149150151152153154155156157158159" [20] "178179180181182183184185186187188189190191192193194195" [21] "214215216217218219220221222223224225226227228229230231" [22] "" [23] "Grayscale" [24] "232 233 234 235 236 237 238 239 240 241 242 243" [25] "244 245 246 247 248 249 250 251 252 253 254 255" 11/14 tohtml.R: sgr_to_html(sgr_256(), classes = class.256) [1] "Standard" [2] " 0 1 2 3 4 5 6 7" [3] "" [4] "High-Intensity" [5] " 8 9 10 11 12 13 14 15" [6] "" [7] "216 Colors (Dark)" [8] " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33" [9] " 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69" [10] " 88 89 90 91 92 93 94 95 96 97 98 99100101102103104105" [11] "124125126127128129130131132133134135136137138139140141" [12] "160161162163164165166167168169170171172173174175176177" [13] "196197198199200201202203204205206207208209210211212213" [14] "" [15] "216 Colors (Light)" [16] " 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51" [17] " 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87" [18] "106107108109110111112113114115116117118119120121122123" [19] "142143144145146147148149150151152153154155156157158159" [20] "178179180181182183184185186187188189190191192193194195" [21] "214215216217218219220221222223224225226227228229230231" [22] "" [23] "Grayscale" [24] "232 233 234 235 236 237 238 239 240 241 242 243" [25] "244 245 246 247 248 249 250 251 252 253 254 255" 11/14 tohtml.R: sgr_to_html("\033[31mhello\033[31m", classes = NULL) Error in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `classes` must be TRUE, FALSE, or a character vector. Calls: unitize_dir ... eval -> eval -> withVisible -> sgr_to_html -> to_html_int 11/14 tohtml.R: sgr_to_html("\033[31mhello\033[31m", classes = character(7L)) Error in check_classes(classes) : Argument `classes` must be length 16, 32, or 512 if it is a character vector (is 7). Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> check_classes 11/14 tohtml.R: sgr_to_html("\033[31mhello\033[31m", classes = rep(NA_character_ Error in check_classes(classes) : Argument `classes` contains NA values. Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> check_classes 11/14 tohtml.R: sgr_to_html("\033[31mhello\033[31m", classes = rep("bad class", Error in check_classes(classes) : Argument `classes` contains charcters other than ASCII letters, numbers, the hyphen, and underscore. Calls: unitize_dir ... withVisible -> sgr_to_html -> to_html_int -> check_classes 11/14 tohtml.R: make_styles(class.8, c(1, 1, 0, 0, 0, 1, 1, 0, 0)) Error in make_styles(class.8, c(1, 1, 0, 0, 0, 1, 1, 0, 0)) : Argument `rgb.mix` must be a 3 x 3 numeric matrix with no NAs. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> make_styles 11/14 tohtml.R: make_styles(class.8, matrix(c(0, 1, 0, 0, 0, 1, 1, 0, NA), 3)) Error in make_styles(class.8, matrix(c(0, 1, 0, 0, 0, 1, 1, 0, NA), 3)) : Argument `rgb.mix` must be a 3 x 3 numeric matrix with no NAs. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> make_styles 11/14 tohtml.R: make_styles(class.8, "hello") Error in make_styles(class.8, "hello") : Argument `rgb.mix` must be a 3 x 3 numeric matrix with no NAs. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> make_styles 11/14 tohtml.R: make_styles(letters, matrix(c(0, 1, 0, 0, 0, 1, 1, 0, 0), 3)) Error in check_classes(classes) : Argument `classes` must be length 16, 32, or 512 if it is a character vector (is 26). Calls: unitize_dir ... eval -> withVisible -> make_styles -> check_classes 11/14 tohtml.R: make_styles(NULL) Error in make_styles(NULL) : Argument `classes` is not character. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> make_styles 11/14 tohtml.R: unitizer_sect("chars to escape", { 11/14 tohtml.R: str.esc <- c("A\033[45mB", "A\033[43m&B") 11/14 tohtml.R: to_html(str.esc) Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : `x` contains unescaped HTML special character '<' at index [1] (see ?html_esc); you can use `warn=FALSE` to turn off these warnings. Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : `x` contains unescaped HTML special character '>' at index [2] (see ?html_esc); you can use `warn=FALSE` to turn off these warnings. [1] "A" [2] "A>B" [3] "A&B" 11/14 tohtml.R: sgr_to_html(str.esc) [1] "A" [2] "A>B" [3] "A&B" 11/14 tohtml.R: to_html(str.esc, warn = FALSE) [1] "A" [2] "A>B" [3] "A&B" 11/14 tohtml.R: to_html(html_esc(str.esc)) [1] "A<B" [2] "A>B" [3] "A&B" 11/14 tohtml.R: str.esc2 <- c("A\033[45mB", "A\033[201mB") 11/14 tohtml.R: to_html(str.esc2) Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : `x` contains unescaped HTML special character '<' at index [1] (see ?html_esc); you can use `warn=FALSE` to turn off these warnings. Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : `x` contains unescaped HTML special character '>' at index [2] (see ?html_esc); you can use `warn=FALSE` to turn off these warnings. Warning in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [3], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "A" [2] "A>B" [3] "AB" 11/14 tohtml.R: to_html(str.esc2, warn = FALSE) [1] "A" [2] "A>B" [3] "AB" 11/14 tohtml.R: unitizer_sect("helpers", { 11/14 tohtml.R: html <- sgr_to_html("\033[42mHello") 11/14 tohtml.R: f <- in_html(html, css = "span {background-color: #CCC;}", displ 11/14 tohtml.R: readLines(f) [1] "" [2] "" [3] "" [6] "" [7] "
"                                                
 [8] "Hello"
 [9] "
" [10] "" [11] "" 11/14 tohtml.R: unlink(f) 11/14 tohtml.R: in_html(html, css = "span {background-color: #CCC;}", display = 11/14 tohtml.R: unitizer_sect("carry", { 11/14 tohtml.R: string.2 <- c("A\033[44m", "B\033[49m", "C", "\033[39mD") 11/14 tohtml.R: to_html(string.2) [1] "A" [2] "B" [3] "C" [4] "D" 11/14 tohtml.R: to_html(string.2, carry = FALSE) [1] "A" "B" "C" "D" 11/14 tohtml.R: to_html(string.2, carry = "\033[33m") [1] "A" [2] "B" [3] "C" [4] "D" 11/14 tohtml.R: to_html(string.2, carry = "\033[33m\033]8;;https://w.z\033\\") [1] "A" [2] "B" [3] "C" [4] "D" 11/14 tohtml.R: string.3 <- c("A\033[44m", "\033[31mC", NA, "\033[39mD") 11/14 tohtml.R: to_html(string.3) [1] "A" [2] "C" [3] NA [4] NA 11/14 tohtml.R: to_html(string.3, carry = FALSE) [1] "A" [2] "C" [3] NA [4] "D" 12/14 trimws.R: 12/14 trimws.R: library(fansi) 12/14 trimws.R: unitizer_sect("Equivalence", { 12/14 trimws.R: txt1 <- c("", "hello", " \t \n\r he\nl\tl\r o \r\t\n", "he\nl\tl 12/14 trimws.R: identical(trimws(txt1), trimws_ctl(txt1)) [1] TRUE 12/14 trimws.R: identical(trimws(txt1, which = "left"), trimws_ctl(txt1, which = [1] TRUE 12/14 trimws.R: identical(trimws(txt1, which = "right"), trimws_ctl(txt1, which [1] TRUE 12/14 trimws.R: unitizer_sect("Controls", { 12/14 trimws.R: txt2 <- c("\033[31m he\033[42;1m llo \033[49m\n\t ", " \033]8;;h 12/14 trimws.R: trimws_ctl(txt2) [1] "\033[31mhe\033[42;1m llo\033[0;1;31m" [2] "\033]8;;https://x.yz\033\\LINK\033[45m hello\033[31m\033]8;;\033\\" 12/14 trimws.R: trimws_ctl(txt2, which = "left") [1] "\033[31mhe\033[42;1m llo \033[49m\n\t " [2] "\033]8;;https://x.yz\033\\LINK\033[45m hello \033]8;;\033\\ \033[31m" 12/14 trimws.R: trimws_ctl(txt2, which = "right") [1] "\033[31m he\033[42;1m llo\033[0;1;31m" [2] " \033]8;;https://x.yz\033\\\tLINK\033[45m hello\033[31m\033]8;;\033\\" 12/14 trimws.R: trimws_ctl(txt2, ctl = c("all", "url", "osc")) Warning in trimws_ctl(txt2, ctl = c("all", "url", "osc")) : Argument `x` contains a non-CSI/OSC escape sequence at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[31mhe\033[42;1m llo\033[0;1;31m" [2] "8;;https://x.yz\033\\\tLINK\033[45m hello \033]8;;\033\\\033[31m" 12/14 trimws.R: trimws_ctl(txt2, ctl = c("all", "sgr", "csi")) Warning in trimws_ctl(txt2, ctl = c("all", "sgr", "csi")) : Argument `x` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in trimws_ctl(txt2, ctl = c("all", "sgr", "csi")) : Argument `x` contains a non-CSI/OSC escape sequence at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "31m he\033[42;1m llo \033[49m" [2] "\033]8;;https://x.yz\033\\LINK\033[45m hello \033]8;;\033\\ \033[31m" 12/14 trimws.R: trimws_ctl(" \r\a A \a\t ", ctl = c("all", "c0")) Warning in trimws_ctl(" \r\a A \a\t ", ctl = c("all", "c0")) : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\a A \a" 12/14 trimws.R: unitizer_sect("Errors / Corner caess", { 12/14 trimws.R: trimws_ctl(character()) character(0) 12/14 trimws.R: trimws_ctl("hello", which = "top") Error in trimws_ctl("hello", which = "top") : Argument `which` must partial match one of c("both", "left", "right"). Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> trimws_ctl 12/14 trimws.R: trimws_ctl("hello", whitespace = " ") Error in trimws_ctl("hello", whitespace = " ") : Argument `whitespace` may only be set to "[ \t\r\n]". Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> trimws_ctl 13/14 url.R: 13/14 url.R: library(fansi) 13/14 url.R: unitizer_sect("wrap", { 13/14 url.R: txt <- "This is a link" 13/14 url.R: base.st <- "%s\033]8;%s;%s\033\\%s\033]8;;\033\\%s" 13/14 url.R: base.a <- "%s\033]8;%s;%s\a%s\033]8;;\a%s" 13/14 url.R: url <- "https://x.yz" 13/14 url.R: u0 <- sprintf(base.st, "", "", url, txt, "") 13/14 url.R: u1 <- sprintf(base.a, "", "", url, txt, "") 13/14 url.R: strtrim_ctl(u0, 5) [1] "\033]8;;https://x.yz\033\\This \033]8;;\033\\" 13/14 url.R: strwrap_ctl(u0, 5) [1] "\033]8;;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u0, 8) [1] "\033]8;;https://x.yz\033\\This is\033]8;;\033\\" [2] "\033]8;;https://x.yz\033\\a link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u1, 5) [1] "\033]8;;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: u2 <- sprintf(base.st, "", "id=one", url, txt, "") 13/14 url.R: u2a <- sprintf(base.st, "", "id=", url, txt, "") 13/14 url.R: u2b <- sprintf(base.st, "", "id", url, txt, "") 13/14 url.R: u3 <- sprintf(base.st, "", "title=ab:id=one", url, txt, "") 13/14 url.R: u4 <- sprintf(base.st, "", "id=one:title=ba", url, txt, "") 13/14 url.R: u6 <- sprintf(base.st, "", "id=one~title=ba", url, txt, "") 13/14 url.R: strwrap_ctl(u2, 5) [1] "\033]8;id=one;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;id=one;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;id=one;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u3, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;id=one;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;id=one;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;id=one;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u4, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;id=one;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;id=one;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;id=one;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u6, 5) [1] "\033]8;id=one~title=ba;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;id=one~title=ba;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;id=one~title=ba;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: u7 <- sprintf(base.st, "AB", "id=one", url, txt, "CD") 13/14 url.R: strwrap_ctl(u7, 8) [1] "AB\033]8;id=one;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;id=one;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;id=one;https://x.yz\033\\link\033]8;;\033\\CD" 13/14 url.R: txt2 <- "This\033[34m is a link\033[49m" 13/14 url.R: u8 <- sprintf(base.st, "A\033[43mB", "", url, txt2, "CD") 13/14 url.R: strwrap_ctl(u8, 7) [1] "A\033[43mB\033]8;;https://x.yz\033\\This\033[0m\033]8;;\033\\" [2] "\033[34;43m\033]8;;https://x.yz\033\\is a\033[0m\033]8;;\033\\" [3] "\033[34;43m\033]8;;https://x.yz\033\\link\033[49m\033]8;;\033\\CD\033[0m" 13/14 url.R: url2 <- ";wow;https://x.yz" 13/14 url.R: u9 <- sprintf(base.st, "", "", url2, txt, "") 13/14 url.R: strwrap_ctl(u9, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;wow;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;;wow;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;;wow;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: u10 <- sprintf(base.st, "", "\a", url, txt, "") 13/14 url.R: u11 <- sprintf(base.st, "", "\016", url, txt, "") 13/14 url.R: Encoding(u10) <- "UTF-8" 13/14 url.R: Encoding(u11) <- "UTF-8" 13/14 url.R: u11a <- sprintf(base.st, "", "hello", url, txt, "") 13/14 url.R: strwrap_ctl(u10, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] ";https://x.yz\033\\This" "is a" [3] "link" 13/14 url.R: strwrap_ctl(u11, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u11a, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with unknown substrings or a OSC hyperlink with unsupported parameters at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;https://x.yz\033\\This\033]8;;\033\\" [2] "\033]8;;https://x.yz\033\\is a\033]8;;\033\\" [3] "\033]8;;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: nchar_ctl(c(u10, u11, u11a)) [1] 27 14 14 13/14 url.R: u12 <- sprintf(base.st, "", "", "\b", txt, "") 13/14 url.R: u12a <- sprintf(base.st, "", "", "\x80", txt, "") 13/14 url.R: Encoding(u12) <- "UTF-8" 13/14 url.R: Encoding(u12a) <- "UTF-8" 13/14 url.R: strwrap_ctl(u12, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "This" "is a" "link" 13/14 url.R: strwrap_ctl(u12a, 5) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains an illegal non-ASCII byte at index [1], see `?unhandled_ctl`. Calls: unitize_dir ... eval -> eval -> withVisible -> strwrap_ctl -> strwrap2_ctl 13/14 url.R: nchar_ctl(c(u12, u12a)) [1] 14 14 13/14 url.R: nchar_ctl(c(u12, u12a), allowNA = TRUE) [1] 14 14 13/14 url.R: u13 <- "a\033]8;;THE END" 13/14 url.R: u13a <- "a\033];;THE END" 13/14 url.R: u14 <- "a\033]8;;THE END\033]8;;NO?" 13/14 url.R: u15 <- "a\033]8;;THE END\033]8;;\033[" 13/14 url.R: strwrap_ctl(u13, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 13/14 url.R: strwrap_ctl(u13, 5, terminate = FALSE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033]8;;THE END" 13/14 url.R: strwrap_ctl(u13a, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a\033];;THE END" 13/14 url.R: strwrap_ctl(u14, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 13/14 url.R: strwrap_ctl(u15, 5) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "a" 13/14 url.R: nchar_ctl(c(u13, u13a, u14, u15)) Warning in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed CSI or OSC sequence at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed CSI or OSC sequence at index [3], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed CSI or OSC sequence at index [4], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] 1 1 1 1 13/14 url.R: u16 <- sprintf(base.st, "", "", "", txt, "") 13/14 url.R: u17 <- sprintf(base.st, "", "", "", "", "") 13/14 url.R: strwrap_ctl(u16, 5) [1] "This" "is a" "link" 13/14 url.R: strwrap_ctl(u17, 5) [1] "" 13/14 url.R: strwrap_ctl(u0, 5, terminate = FALSE) [1] "\033]8;;https://x.yz\033\\This" [2] "\033]8;;https://x.yz\033\\is a" [3] "\033]8;;https://x.yz\033\\link\033]8;;\033\\" 13/14 url.R: open <- "\033]8;;ab.c\033\\" 13/14 url.R: u21 <- c("he\033[44mllo \033]8;;de.f\033\\world", "night moon") 13/14 url.R: strwrap_ctl(u21, 5, carry = "\033[33m") [1] "\033[33mhe\033[44mllo\033[0m" [2] "\033[33;44m\033]8;;de.f\033\\world\033[0m\033]8;;\033\\" [3] "\033[33;44m\033]8;;de.f\033\\night\033[0m\033]8;;\033\\" [4] "\033[33;44m\033]8;;de.f\033\\moon\033[0m\033]8;;\033\\" 13/14 url.R: strwrap_ctl(u21, 5, carry = paste0(open, "\033[33m")) [1] "\033[33m\033]8;;ab.c\033\\he\033[44mllo\033[0m\033]8;;\033\\" [2] "\033[33;44m\033]8;;de.f\033\\world\033[0m\033]8;;\033\\" [3] "\033[33;44m\033]8;;de.f\033\\night\033[0m\033]8;;\033\\" [4] "\033[33;44m\033]8;;de.f\033\\moon\033[0m\033]8;;\033\\" 13/14 url.R: unitizer_sect("normalize", { 13/14 url.R: u18 <- "A\033]8;id=a;x.yz\033\\B\033]8;id=a;x.yz\033\\C\033]8;;\033 13/14 url.R: normalize_state(u18) [1] "A\033]8;id=a;x.yz\033\\BC\033]8;;\033\\D" 13/14 url.R: u18a <- "A\033]8;id=a;x.yz\033\\B\033]8;;\033\\\033]8;id=a;x.yz\033 13/14 url.R: normalize_state(u18a) [1] "A\033]8;id=a;x.yz\033\\BC\033]8;;\033\\D" 13/14 url.R: u18b <- "A\033]8;id=a;x.yz\033\\\033]8;id=b;x.yz\033\\C\033]8;;\033 13/14 url.R: normalize_state(u18b) [1] "A\033]8;id=b;x.yz\033\\C\033]8;;\033\\D" 13/14 url.R: u19 <- "A\033]8;id=a;x.yz\033\\B\033]8;id=b;x.yz\033\\C\033]8;;\033 13/14 url.R: u20 <- "A\033]8;id=a;x.yz\033\\B\033]8;id=a;w.yz\033\\C\033]8;;\033 13/14 url.R: normalize_state(u19) [1] "A\033]8;id=a;x.yz\033\\B\033]8;id=b;x.yz\033\\C\033]8;;\033\\D" 13/14 url.R: normalize_state(u20) [1] "A\033]8;id=a;x.yz\033\\B\033]8;id=a;w.yz\033\\C\033]8;;\033\\D" 13/14 url.R: unitizer_sect("substr", { 13/14 url.R: substr_ctl(u0, 6, 9) [1] "\033]8;;https://x.yz\033\\is a\033]8;;\033\\" 13/14 url.R: substr_ctl(u0, 6, 9, terminate = FALSE) [1] "\033]8;;https://x.yz\033\\is a" 13/14 url.R: substr_ctl("hello world", 3, 8, carry = "\033]8;;a.b\033\\") [1] "\033]8;;a.b\033\\llo wo\033]8;;\033\\" 13/14 url.R: np.bytes <- c("A\033]8;a=\r:id=c;x.y\033\\B", "A\033]8;a=c:id=\r;x. 13/14 url.R: Encoding(np.bytes) <- "UTF-8" 13/14 url.R: substr_ctl(np.bytes[1:3], 2, 2) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [2], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [3], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;id=c;x.y\033\\B\033]8;;\033\\" [2] "\033]8;;x.y\033\\B\033]8;;\033\\" [3] "B" 13/14 url.R: substr_ctl(np.bytes[4], 2, 2) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains an illegal non-ASCII byte at index [1], see `?unhandled_ctl`. Calls: unitize_dir ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal 13/14 url.R: unitizer_sect("tohtml", { 13/14 url.R: to_html(u0) [1] "This is a link" 13/14 url.R: to_html("A\033[44mB\033]8;;x.y\033\\C\033[33m\033]8;;\033\\D") [1] "ABCD" 13/14 url.R: to_html("A\033[44mB\033]8;;x.y\033\\C\033[33m\033]8;;w.z\033\\D") [1] "ABCD" 13/14 url.R: u23 <- c("A \033[44mB \033]8;;x.y\033\\C \033[33m\033]8;;w.z\033\\D 13/14 url.R: to_html(u23) [1] "A B C D" [2] "E F G" [3] "H I" 13/14 url.R: to_html(strwrap_ctl(u23, 4)) [1] "A B" [2] "C D" [3] "E F" [4] "G" [5] "H I" 13/14 url.R: unitizer_sect("osc", { 13/14 url.R: nchar_ctl("\033]hello \aworld") [1] 5 13/14 url.R: nchar_ctl("\033]hello \033\\world") [1] 5 13/14 url.R: nchar_ctl("\033]hello \033\\world", ctl = c("all", "osc")) [1] 11 13/14 url.R: x <- "\033]hello\x80\033\\world" 13/14 url.R: Encoding(x) <- "UTF-8" 13/14 url.R: nchar_ctl(x) [1] 5 13/14 url.R: nchar_ctl("\033]hello world") Warning in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed CSI or OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] 0 14/14 wrap.R: 14/14 wrap.R: library(unitizer) 14/14 wrap.R: library(fansi) 14/14 wrap.R: unitizer_sect("Basic wrap", { 14/14 wrap.R: hello.0 <- "hello world this is a lovely day" 14/14 wrap.R: strwrap_ctl(hello.0, width = 10) [1] "hello" "world" "this is a" "lovely" "day" 14/14 wrap.R: hello.1 <- "hello world this is. a lovely day." 14/14 wrap.R: strwrap_ctl(hello.1, width = 10) [1] "hello" "world" "this is." "a lovely" "day." 14/14 wrap.R: hello.2 <- "hello\rworld\rthis is. a lovely day." 14/14 wrap.R: strwrap_ctl(hello.2, width = 10) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello\rworld\rthis" "is. a" "lovely" [4] "day." 14/14 wrap.R: hello.3 <- "hello\rworld\nthis is. a lovely\n day." 14/14 wrap.R: strwrap_ctl(hello.3, width = 10) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello\rworld" "this is." "a lovely" "day." 14/14 wrap.R: hello.4 <- " hello world this is a lovely day." 14/14 wrap.R: strwrap_ctl(hello.4, width = 10) [1] "hello" "world" "this is a" "lovely" "day." 14/14 wrap.R: hello.5 <- "hello.\n\n\nworld" 14/14 wrap.R: strwrap_ctl(hello.5, width = 10) [1] "hello." "" "world" 14/14 wrap.R: hello.5a <- "hello.\n \n \nworld" 14/14 wrap.R: strwrap_ctl(hello.5a, width = 10) [1] "hello." "" "world" 14/14 wrap.R: hello.6a <- "hello.\" there" 14/14 wrap.R: strwrap_ctl(hello.6a, width = 40) [1] "hello.\" there" 14/14 wrap.R: hello.6b <- "hello.' there" 14/14 wrap.R: strwrap_ctl(hello.6b, width = 40) [1] "hello.' there" 14/14 wrap.R: hello.6c <- "hello.) there" 14/14 wrap.R: strwrap_ctl(hello.6c, width = 40) [1] "hello.) there" 14/14 wrap.R: unitizer_sect("Basic Ansi", { 14/14 wrap.R: hello2.0 <- paste0("hello ", red, "world ", grn.bg, " this is a l 14/14 wrap.R: strwrap_ctl(hello2.0, 10) [1] "hello" "\033[31mworld\033[0m" [3] "\033[31;42mthis is a\033[0m" "\033[31;42mlovely\033[0mday." 14/14 wrap.R: strwrap_ctl(strip_ctl(hello2.0, "sgr"), 10) [1] "hello" "world" "this is a" "lovelyday." 14/14 wrap.R: hello2.1 <- paste0("hello \033[41mworld\033[m how are you today") 14/14 wrap.R: hello2.2 <- paste0("hello \033[41mworld\033[0m how are you today") 14/14 wrap.R: strwrap_ctl(hello2.1, 15) [1] "hello \033[41mworld\033[0m" "how are you" [3] "today" 14/14 wrap.R: hello.bold.faint <- paste0("hello \033[1mbolded once upon a time\0 14/14 wrap.R: strwrap_ctl(hello.bold.faint, 10) [1] "hello" "\033[1mbolded\033[0m" [3] "\033[1monce upon\033[0m" "\033[1ma time\033[0m" [5] "normal" "\033[2mfainting\033[0m" [7] "\033[2min\033[0m" "\033[2mfaintness\033[0m" [9] "\033[2moh no\033[0m" "normal" 14/14 wrap.R: hello.blinky <- paste0("hello \033[5mbliking slowly oh my\033[25m 14/14 wrap.R: strwrap_ctl(hello.blinky, 10) [1] "hello" "\033[5mbliking\033[0m" [3] "\033[5mslowly oh\033[0m" "\033[5mmy\033[25m normal" [5] "\033[6mblinking\033[0m" "\033[6mquickly\033[0m" [7] "\033[6moh my\033[0m" "normal" 14/14 wrap.R: strwrap_ctl(hello.blinky, 10, terminate = FALSE) [1] "hello" "\033[5mbliking" "slowly oh" [4] "my\033[25m normal" "\033[6mblinking" "quickly" [7] "oh my" "\033[0mnormal" 14/14 wrap.R: hello2.3 <- c(hello2.1, hello2.2) 14/14 wrap.R: strwrap_ctl(hello2.3, 10, simplify = FALSE) [[1]] [1] "hello" "\033[41mworld\033[m how" [3] "are you" "today" [[2]] [1] "hello" "\033[41mworld\033[0m how" [3] "are you" "today" 14/14 wrap.R: strwrap2_ctl(hello2.3, 10, simplify = FALSE) [[1]] [1] "hello" "\033[41mworld\033[m how" [3] "are you" "today" [[2]] [1] "hello" "\033[41mworld\033[0m how" [3] "are you" "today" 14/14 wrap.R: strwrap_ctl("aliquip \033[31mex ea commodo consequat\033[0m\n", [1] "aliquip \033[31mex ea commodo\033[0m" [2] "\033[31mconsequat\033[0m" 14/14 wrap.R: unitizer_sect("Long Wrap", { 14/14 wrap.R: wrap.csi <- strwrap_ctl(lorem.r.thanks, 40) 14/14 wrap.R: nchar(strip_ctl(wrap.csi, "sgr")) [1] 34 37 30 13 0 37 38 9 0 39 36 37 15 0 35 39 37 37 31 25 0 39 37 38 39 [26] 5 0 39 36 34 33 36 39 27 0 31 29 37 39 35 34 37 34 31 36 25 37 14/14 wrap.R: nchar(wrap.csi) [1] 44 37 30 13 0 68 56 17 0 98 55 57 25 0 61 47 63 90 72 61 0 68 37 38 49 [26] 5 0 75 54 47 49 64 67 45 0 91 78 87 88 74 73 86 54 60 75 25 67 14/14 wrap.R: unitizer_sect("Other Escapes", { 14/14 wrap.R: strwrap_ctl("hello \033kworld yohoo", 12) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello \033kworld" "yohoo" 14/14 wrap.R: strwrap_ctl("hello \033\nworld yohoo", 12) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello \033\nworld" "yohoo" 14/14 wrap.R: c0 <- "hello\037\037\037\037\037\037 world yohoo" 14/14 wrap.R: Encoding(c0) <- "UTF-8" 14/14 wrap.R: strwrap_ctl(c0, 12) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello\037\037\037\037\037\037 world" "yohoo" 14/14 wrap.R: strwrap_ctl("hello \033[999mworld", 6) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" "world" 14/14 wrap.R: strwrap_ctl("hello \033[31#31mworld", 6) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence or OSC hyperlink with invalid substrings at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" "world" 14/14 wrap.R: strwrap_ctl("hello \033[999nworld", 6) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" "\033[999nworld" 14/14 wrap.R: strwrap_ctl("hello \033[999mworld", 6, warn = FALSE) [1] "hello" "world" 14/14 wrap.R: strwrap_ctl("hello \033[31#31mworld", 6, warn = FALSE) [1] "hello" "world" 14/14 wrap.R: strwrap_ctl("hello \033[999nworld", 6, warn = FALSE) [1] "hello" "\033[999nworld" 14/14 wrap.R: unitizer_sect("prefix / initial simple", { 14/14 wrap.R: lorem.sentence <- unlist(strsplit_ctl(lorem, "[.]\\K ", perl = TRU 14/14 wrap.R: lorem.sentence <- gsub(",", ",\n", lorem.sentence, fixed = TRUE) 14/14 wrap.R: lorem.para <- c(paste0(lorem.sentence[1:2], collapse = "\n\n"), 14/14 wrap.R: strwrap_ctl(lorem.para, indent = 2) [1] " Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do" [2] "eiusmod tempor incididunt ut labore et dolore magna aliqua." [3] "" [4] " Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris" [5] "nisi ut aliquip ex ea commodo consequat." [6] " Duis aute irure dolor in reprehenderit in voluptate velit esse cillum" [7] "dolore eu fugiat nulla pariatur." [8] "" [9] " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui" [10] "officia deserunt mollit anim id est laborum." 14/14 wrap.R: strwrap_ctl(lorem.para, exdent = 2) [1] "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" [2] " tempor incididunt ut labore et dolore magna aliqua." [3] "" [4] "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi" [5] " ut aliquip ex ea commodo consequat." [6] "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum" [7] " dolore eu fugiat nulla pariatur." [8] "" [9] "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui" [10] " officia deserunt mollit anim id est laborum." 14/14 wrap.R: strwrap_ctl(lorem.para, indent = 4, exdent = 2) [1] " Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do" [2] " eiusmod tempor incididunt ut labore et dolore magna aliqua." [3] "" [4] " Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris" [5] " nisi ut aliquip ex ea commodo consequat." [6] " Duis aute irure dolor in reprehenderit in voluptate velit esse" [7] " cillum dolore eu fugiat nulla pariatur." [8] "" [9] " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui" [10] " officia deserunt mollit anim id est laborum." 14/14 wrap.R: unitizer_sect("prefix / initial with ESC", { 14/14 wrap.R: pre <- "\033[32m+ \033[0m" 14/14 wrap.R: ini <- "\033[33m> \033[0m" 14/14 wrap.R: hello.8a <- "hello world yohoo" 14/14 wrap.R: wrap.csi.2 <- strwrap_ctl(hello.8a, 14, prefix = pre, initial = in 14/14 wrap.R: wrap.csi.2 [1] "\033[33m> \033[0mhello world" "\033[32m+ \033[0myohoo" 14/14 wrap.R: hello.8b <- c(hello.8a, "oh my this has 2 elements") 14/14 wrap.R: wrap.csi.3 <- strwrap_ctl(hello.8b, 14, prefix = pre, initial = in 14/14 wrap.R: wrap.csi.3 [1] "\033[33m> \033[0mhello world" "\033[32m+ \033[0myohoo" [3] "\033[32m+ \033[0moh my this" "\033[32m+ \033[0mhas 2" [5] "\033[32m+ \033[0melements" 14/14 wrap.R: unitizer_sect("wrap2", { 14/14 wrap.R: hello.9a <- "hello\t\033[41mred\033[49m\tworld" 14/14 wrap.R: strwrap2_ctl(hello.9a, 12) [1] "hello \033[41mred\033[0m" "world" 14/14 wrap.R: strwrap2_ctl(hello.9a, 12, tabs.as.spaces = TRUE) [1] "hello \033[41mred\033[49m" " world" 14/14 wrap.R: strwrap2_ctl(hello.9a, 13, tabs.as.spaces = TRUE) [1] "hello \033[41mred\033[49m " " world" 14/14 wrap.R: strwrap2_ctl(hello.9a, 12, tabs.as.spaces = TRUE, tab.stops = c(6, [1] "hello \033[41mred\033[49m " " " [3] "world" 14/14 wrap.R: r.thanks <- lorem.r.thanks.2 14/14 wrap.R: bg <- ceiling(seq_along(r.thanks)/length(r.thanks) * 215) + 16 14/14 wrap.R: fg <- ifelse((((bg - 16)%/%18)%%2), 30, 37) 14/14 wrap.R: tpl <- "\033[%d;48;5;%dm%s\033[49m" 14/14 wrap.R: nz <- nzchar(r.thanks) 14/14 wrap.R: r.thanks[nz] <- sprintf(tpl, fg[nz], bg[nz], r.thanks[nz]) 14/14 wrap.R: r.col <- paste0(r.thanks, collapse = "\n") 14/14 wrap.R: r.wrap <- strwrap2_ctl(r.col, 35, pad.end = " ", wrap.always = TRU 14/14 wrap.R: (r.wrap) [1] "\033[37;48;5;23mMany more, too numerous to mention\033[0m" [2] "\033[37;48;5;23mhere, have contributed by sending \033[0m" [3] "\033[37;48;5;23mbug\033[49m \033[37;48;5;30mreports and suggesting various\033[0m" [4] "\033[37;48;5;30mimprovements.\033[49m \033[0m" [5] "\033[37m \033[0m" [6] "\033[30;48;5;43mSimon Davies whilst at the \033[0m" [7] "\033[30;48;5;43mUniversity of Auckland wrote the \033[0m" [8] "\033[30;48;5;43moriginal\033[49m \033[30;48;5;50mversion of glm().\033[49m \033[0m" [9] "\033[30m \033[0m" [10] "\033[37;48;5;64mJulian Harris and Wing Kwong \033[0m" [11] "\033[37;48;5;64m(Tiki) Wan whilst at the \033[0m" [12] "\033[37;48;5;64mUniversity of\033[49m \033[30;48;5;70mAuckland assisted \033[0m" [13] "\033[30;48;5;70mRoss Ihaka with the original \033[0m" [14] "\033[30;48;5;70mMacintosh port.\033[49m \033[0m" [15] "\033[30m \033[0m" [16] "\033[30;48;5;84mR was inspired by the S \033[0m" [17] "\033[30;48;5;84menvironment which has been \033[0m" [18] "\033[30;48;5;84mprincipally\033[49m \033[37;48;5;90mdeveloped by John \033[0m" [19] "\033[37;48;5;90mChambers, with substantial input \033[0m" [20] "\033[37;48;5;90mfrom Douglas Bates,\033[49m \033[37;48;5;97mRick Becker, \033[0m" [21] "\033[37;48;5;97mBill Cleveland, Trevor Hastie, \033[0m" [22] "\033[37;48;5;97mDaryl Pregibon and\033[49m \033[37;48;5;104mAllan Wilks.\033[49m \033[0m" [23] "\033[37m \033[0m" [24] "\033[30;48;5;117mA special debt is owed to John \033[0m" [25] "\033[30;48;5;117mChambers who has graciously \033[0m" [26] "\033[30;48;5;117mcontributed\033[49m \033[37;48;5;124madvice and \033[0m" [27] "\033[37;48;5;124mencouragement in the early days of\033[0m" [28] "\033[37;48;5;124mR and later became a\033[49m \033[37;48;5;131mmember of the\033[0m" [29] "\033[37;48;5;131mcore team.\033[49m \033[0m" [30] "\033[37m \033[0m" [31] "\033[30;48;5;158mThe R Foundation may decide to \033[0m" [32] "\033[30;48;5;158mgive out \033[0m" [33] "\033[30;48;5;158m@R-project.org\033[49m \033[0m" [34] "\033[37;48;5;164memail addresses to contributors to\033[0m" [35] "\033[37;48;5;164mthe R Project (even without making\033[0m" [36] "\033[37;48;5;164mthem\033[49m \033[37;48;5;171mmembers of the R Foundation) \033[0m" [37] "\033[37;48;5;171mwhen in the view of the R \033[0m" [38] "\033[37;48;5;171mFoundation this\033[49m \033[30;48;5;178mwould help advance\033[0m" [39] "\033[30;48;5;178mthe R project.\033[49m \033[0m" [40] "\033[30m \033[0m" [41] "\033[30;48;5;191mThe R Core Group, Roger Bivand, \033[0m" [42] "\033[30;48;5;191mJennifer Bryan, Di Cook, Dirk \033[0m" [43] "\033[30;48;5;191mEddelbuettel,\033[49m \033[37;48;5;198mJohn Fox, Bettina \033[0m" [44] "\033[37;48;5;198mGrün, Frank Harrell, Torsten \033[0m" [45] "\033[37;48;5;198mHothorn, Stefano Iacus,\033[49m \033[37;48;5;205mJulie \033[0m" [46] "\033[37;48;5;205mJosse, Balasubramanian Narasimhan,\033[0m" [47] "\033[37;48;5;205mMarc Schwartz, Heather Turner,\033[49m \033[0m" [48] "\033[37;48;5;211mBill Venables, Hadley Wickham and \033[0m" [49] "\033[37;48;5;211mAchim Zeileis are the ordinary \033[0m" [50] "\033[37;48;5;211mmembers of\033[49m \033[30;48;5;218mthe R Foundation.\033[49m \033[30;48;5;225mIn \033[0m" [51] "\033[30;48;5;225maddition, David Meyer and Simon \033[0m" [52] "\033[30;48;5;225mWood are also e-addressable by\033[49m \033[0m" [53] "\033[30;48;5;231m.@R-project.o\033[0m" [54] "\033[30;48;5;231mrg.\033[49m \033[0m" 14/14 wrap.R: hello.9b <- "\033[41mhello\n\nworld." 14/14 wrap.R: strwrap2_ctl(hello.9b, 8, pad.end = " ") [1] "\033[41mhello \033[0m" "\033[41m \033[0m" "\033[41mworld. \033[0m" 14/14 wrap.R: strwrap2_ctl(hello.9b, 8, pad.end = 0) [1] "\033[41mhello00\033[0m" "\033[41m0000000\033[0m" "\033[41mworld.0\033[0m" 14/14 wrap.R: hello.9b <- " \033[41mhello world." 14/14 wrap.R: strwrap2_ctl(hello.9b, 8, strip.spaces = FALSE) [1] " \033[41mhello\033[0m" "\033[41m world.\033[0m" 14/14 wrap.R: hello.9c <- "\033[41m hello world." 14/14 wrap.R: ws.0 <- "hello worldza" 14/14 wrap.R: ws.1 <- "hello \t worldza" 14/14 wrap.R: ws.2 <- "hello \n worldza" 14/14 wrap.R: strwrap2_sgr(ws.0, 7, strip.spaces = FALSE) [1] "hello " " " "worldza" 14/14 wrap.R: strwrap2_sgr(ws.0, 7, strip.spaces = FALSE, wrap.always = TRUE) [1] "hello " " " "worldz" "a" 14/14 wrap.R: strwrap2_sgr(ws.0, 6, strip.spaces = FALSE) [1] "hello" " " "worldza" 14/14 wrap.R: strwrap2_sgr(ws.0, 6, strip.spaces = FALSE, wrap.always = TRUE) [1] "hello" " " "world" "za" 14/14 wrap.R: strwrap2_sgr(ws.1, 7, strip.spaces = FALSE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello " "\t " "worldza" 14/14 wrap.R: strwrap2_sgr(ws.1, 7, strip.spaces = FALSE, wrap.always = TRUE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello " "\t " "worldz" "a" 14/14 wrap.R: strwrap2_sgr(ws.1, 6, strip.spaces = FALSE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" " \t " "worldza" 14/14 wrap.R: strwrap2_sgr(ws.1, 6, strip.spaces = FALSE, wrap.always = TRUE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello" " \t " "world" "za" 14/14 wrap.R: strwrap2_sgr(" hello world ", 7, strip.spaces = FALSE) [1] " hello" " world" " " 14/14 wrap.R: strwrap2_sgr("\thello\tworld\t", 7, strip.spaces = FALSE) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\thello" "\tworld" "\t" 14/14 wrap.R: strwrap2_sgr("\nhello\nworld\n", 7, strip.spaces = FALSE) [1] "" "hello" "world" "" 14/14 wrap.R: unitizer_sect("_sgr", { 14/14 wrap.R: hello.9e <- c("hello\t\033[91mworld\033[m\t\033[38;2;31;42;4mworld 14/14 wrap.R: strwrap_sgr(hello.9e, 12, term.cap = "256") Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello \033[91mworld\033[0m" [2] "\033[38;2;31;42;4mworld\033[0m" [3] "\033[38;2;31;42;4mboohaythere\033[0m" [4] "asdfasdfasdfasdf" 14/14 wrap.R: hello.9f <- "hello \033[91mworld boohaythereyowza" 14/14 wrap.R: strwrap2_sgr(hello.9f, 12, prefix = "++", initial = ">>", wrap.alw [1] ">>hello ~~~" "\033[91m++world ~~~\033[0m" [3] "\033[91m++boohaythe\033[0m" "\033[91m++reyowza~~\033[0m" 14/14 wrap.R: strwrap2_sgr(hello.9e, 12, tabs.as.spaces = TRUE, tab.stops = c(6, [[1]] [1] ">> hello ~" [2] "\033[91m++ world\033[m " [3] "++ \033[38;2;31;42;4mworld\033[0m" [4] "\033[38;2;31;42;4m++ ~~~~~~~\033[0m" [5] "\033[38;2;31;42;4m++ boohayth\033[0m" [6] "\033[38;2;31;42;4m++ ere~~~~~\033[0m" [[2]] [1] "++ asdfasd" "++ fasdfasd" "++ f~~~~~~~" 14/14 wrap.R: strwrap_sgr(hello.9e, 12, warn = FALSE, indent = 2, exdent = 1, [[1]] [1] ">> hello" [2] "\033[91m++ world\033[0m" [3] "\033[38;2;31;42;4m++ world\033[0m" [4] "\033[38;2;31;42;4m++ boohaythere\033[0m" [[2]] [1] "++ asdfasdfasdfasdf" 14/14 wrap.R: strwrap_sgr(hello.9e, 12, indent = 2, exdent = 1, prefix = "++", Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [[1]] [1] ">> hello" [2] "\033[91m++ world\033[0m" [3] "\033[38;2;31;42;4m++ world\033[0m" [4] "\033[38;2;31;42;4m++ boohaythere\033[0m" [[2]] [1] "++ asdfasdfasdfasdf" 14/14 wrap.R: unitizer_sect("long words", { 14/14 wrap.R: hello.long <- "\033[31mhelloworld\033[mlongword" 14/14 wrap.R: strwrap_ctl(hello.long, 8) [1] "\033[31mhelloworld\033[mlongword" 14/14 wrap.R: strwrap2_ctl(hello.long, 8, wrap.always = TRUE) [1] "\033[31mhellowo\033[0m" "\033[31mrld\033[mlong" "word" 14/14 wrap.R: unitizer_sect("rare escapes", { 14/14 wrap.R: hello.border <- c("hello \033[51mworld woohoo\033[54m woohoo", 14/14 wrap.R: strwrap_ctl(hello.border, 12) [1] "hello \033[51mworld\033[0m" "\033[51mwoohoo\033[0m" [3] "woohoo" "hello \033[52mworld\033[0m" [5] "\033[52mwoohoo\033[0m" "woohoo" [7] "hello \033[53mworld\033[0m" "\033[53mwoohoo\033[0m" [9] "woohoo" 14/14 wrap.R: strwrap_ctl(hello.border, 12, terminate = FALSE) [1] "hello \033[51mworld" "woohoo" "\033[0mwoohoo" [4] "hello \033[52mworld" "woohoo" "\033[0mwoohoo" [7] "hello \033[53mworld" "woohoo" "\033[0mwoohoo" 14/14 wrap.R: hello.ideogram <- c("hello \033[60mworld woohoo\033[65m woohoo", 14/14 wrap.R: strwrap_ctl(hello.ideogram, 12, terminate = FALSE) [1] "hello \033[60mworld" "woohoo" "\033[0mwoohoo" [4] "hello \033[61mworld" "woohoo" "\033[0mwoohoo" [7] "hello \033[62mworld" "woohoo" "\033[0mwoohoo" [10] "hello \033[63mworld" "woohoo" "\033[0mwoohoo" [13] "hello \033[64mworld" "woohoo" "\033[0mwoohoo" 14/14 wrap.R: hello.font <- c("hello \033[10mworld woohoo\033[10m woohoo", 14/14 wrap.R: strwrap_ctl(hello.font, 12, terminate = FALSE) [1] "hello \033[10mworld" "woohoo" "woohoo" [4] "hello \033[11mworld" "woohoo" "\033[0mwoohoo" [7] "hello \033[12mworld" "woohoo" "\033[0mwoohoo" [10] "hello \033[13mworld" "woohoo" "\033[0mwoohoo" [13] "hello \033[14mworld" "woohoo" "\033[0mwoohoo" [16] "hello \033[15mworld" "woohoo" "\033[0mwoohoo" [19] "hello \033[16mworld" "woohoo" "\033[0mwoohoo" [22] "hello \033[17mworld" "woohoo" "\033[0mwoohoo" [25] "hello \033[18mworld" "woohoo" "\033[0mwoohoo" [28] "hello \033[19mworld" "woohoo" "\033[0mwoohoo" 14/14 wrap.R: unitizer_sect("term cap and bright", { 14/14 wrap.R: getOption("fansi.term.cap", dflt_term_cap()) [1] "bright" "256" 14/14 wrap.R: hello.bright <- "\033[42mhello \033[103mworld wowza\033[49m" 14/14 wrap.R: strwrap_ctl(hello.bright, 13) [1] "\033[42mhello \033[103mworld\033[0m" "\033[103mwowza\033[0m" 14/14 wrap.R: strwrap_ctl(hello.bright, 13, term.cap = character()) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[42mhello \033[103mworld\033[0m" "\033[103mwowza\033[0m" 14/14 wrap.R: hello.255 <- "\033[42mhello \033[48;5;47mworld wowza\033[49m" 14/14 wrap.R: strwrap_ctl(hello.255, 13) [1] "\033[42mhello \033[48;5;47mworld\033[0m" [2] "\033[48;5;47mwowza\033[0m" 14/14 wrap.R: strwrap_ctl(hello.255, 13, term.cap = character()) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[42mhello \033[48;5;47mworld\033[0m" [2] "\033[48;5;47mwowza\033[0m" 14/14 wrap.R: hello.tru <- "\033[42mhello \033[48;2;7;41;4mworld wowza\033[m" 14/14 wrap.R: strwrap_ctl(hello.tru, 13, term.cap = "truecolor") [1] "\033[42mhello \033[48;2;7;41;4mworld\033[0m" [2] "\033[48;2;7;41;4mwowza\033[0m" 14/14 wrap.R: strwrap_ctl(hello.tru, 13) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a CSI SGR sequence with color codes not supported by terminal at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[42mhello \033[48;2;7;41;4mworld\033[0m" [2] "\033[48;2;7;41;4mwowza\033[0m" 14/14 wrap.R: unitizer_sect("corner cases", { 14/14 wrap.R: strwrap_ctl("a", -1) [1] "a" 14/14 wrap.R: strwrap2_ctl("a", -1) [1] "a" 14/14 wrap.R: strwrap2_ctl("a", Inf) [1] "a" 14/14 wrap.R: strwrap2_ctl("a", NA_real_) Error in strwrap2_ctl("a", NA_real_) : Argument `width` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap2_ctl("a", NA_integer_) Error in strwrap2_ctl("a", NA_integer_) : Argument `width` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap2_ctl("a", -1, wrap.always = TRUE) Error in strwrap2_ctl("a", -1, wrap.always = TRUE) : Width must be at least 2 in `wrap.always` mode. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: strwrap2_ctl("a", 0, wrap.always = TRUE) Error in strwrap2_ctl("a", 0, wrap.always = TRUE) : Width must be at least 2 in `wrap.always` mode. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: strwrap2_ctl("a", 1, wrap.always = TRUE) Error in strwrap2_ctl("a", 1, wrap.always = TRUE) : Width must be at least 2 in `wrap.always` mode. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: tryCatch(strwrap_ctl("hello world", 6, prefix = "\033p"), warning [1] "Argument `prefix` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings." 14/14 wrap.R: suppressWarnings(strwrap_ctl("hello world", 6, prefix = "\033p")) [1] "\033phello" "\033pworld" 14/14 wrap.R: tryCatch(strwrap2_ctl("hello world", 8, pad.end = "\t"), error = c [1] "Argument `pad.end` must be an empty string or a single printable ASCII character." 14/14 wrap.R: tryCatch(strwrap2_ctl("hello world", 8, pad.end = " "), error = c [1] "Argument `pad.end` must be at most one byte long." 14/14 wrap.R: strwrap2_ctl("goodbye moon", 8, indent = 5, prefix = "> hello >") [1] "> hello > goodbye" "> hello >moon" 14/14 wrap.R: strwrap2_ctl("goodbye moon", 16, indent = 5, prefix = "> hello >", [1] "> hello > g" "> hello >oodbye" "> hello >moon" 14/14 wrap.R: tryCatch(strwrap2_ctl("goodbye moon", 15, indent = 5, prefix = "> [1] "Width error: sum of `indent` and `initial` width or sum of `exdent` and `prefix` width must be less than `width - 1` when in `wrap.always`." 14/14 wrap.R: strwrap_ctl("hello world\033[31m\033A", 12) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello world\033[31m\033A\033[0m" 14/14 wrap.R: strwrap_ctl("hello world\033A\033[31m", 12) Warning in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a non-CSI/OSC escape sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "hello world\033A" 14/14 wrap.R: strwrap_ctl("hello \033[44m world", 5) [1] "hello" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \033[44m world", 6) [1] "hello" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \033[44m world", 5, terminate = FALSE) [1] "hello" "\033[44mworld" 14/14 wrap.R: strwrap_ctl("hello \033[44m world", 6, terminate = FALSE) [1] "hello" "\033[44mworld" 14/14 wrap.R: strwrap_ctl("hello\n\033[44m\nworld", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \n\033[44m\n world", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \n \033[44m\n world", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \n \n\033[44mworld", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \n \n\033[44m world", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \n \n\033[44m\nworld", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap_ctl("hello \033[44m\n\n world", 5) [1] "hello" "" "\033[44mworld\033[0m" 14/14 wrap.R: strwrap("hello \n\n world", 5) [1] "hello" "" "world" 14/14 wrap.R: strwrap_ctl("\033[33mAB\033[44m CD", 3) [1] "\033[33mAB\033[0m" "\033[33;44mCD\033[0m" 14/14 wrap.R: strwrap2_ctl("AB\033[44m\n\nCD", 3, wrap.always = TRUE) [1] "AB" "" "\033[44mCD\033[0m" 14/14 wrap.R: strwrap2_ctl("AB\033[44m\n\nCD", 3, wrap.always = TRUE, pad.end = [1] "AB" "\033[44m##\033[0m" "\033[44mCD\033[0m" 14/14 wrap.R: strwrap2_ctl("AB\033[44m\n\nCD", 3, wrap.always = TRUE, terminate [1] "AB" "\033[44m" "CD" 14/14 wrap.R: strwrap2_ctl("AB\033[44m CD", 4, pad.end = "#") [1] "AB\033[44m#\033[0m" "\033[44mCD#\033[0m" 14/14 wrap.R: strwrap2_ctl("AB\033[44m CD", 3, pad.end = "#") [1] "AB" "\033[44mCD\033[0m" 14/14 wrap.R: strwrap2_sgr("\033[43mAB \033[34mCD", strip.spaces = FALSE, 4) [1] "\033[43mAB \033[0m" "\033[34;43mCD\033[0m" 14/14 wrap.R: strwrap_ctl("\033[31m\033[43m", 5) [1] "" 14/14 wrap.R: strwrap2_ctl("a\033[31mb", 2, wrap.always = TRUE) [1] "a" "\033[31mb\033[0m" 14/14 wrap.R: strwrap_ctl("A \033[31mB\033[39m", 3) [1] "A" "\033[31mB\033[0m" 14/14 wrap.R: strwrap2_ctl("\033[35phello \033[35p world", 5, strip.spaces = FAL Warning in strwrap2_ctl("\033[35phello \033[35p world", 5, strip.spaces = FALSE) : Argument `x` contains a non-SGR CSI or a non-URL OSC sequence at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[35phello" " \033[35p " "world" 14/14 wrap.R: identical(strwrap(c(NA, "a b"), 4, prefix = ">"), strwrap_ctl(c(NA [1] TRUE 14/14 wrap.R: identical(strwrap("a b", 4, prefix = NA), strwrap_ctl("a b", [1] TRUE 14/14 wrap.R: unitizer_sect("bad inputs", { 14/14 wrap.R: strwrap_ctl(1:3) [1] "1" "2" "3" 14/14 wrap.R: strwrap_ctl(hello2.0, width = "35") Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `width` must be numeric. Calls: unitize_dir ... strwrap_ctl -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, width = NA_integer_) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `width` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, indent = NA_integer_) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `indent` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, indent = -3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `indent` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, exdent = -3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `exdent` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, exdent = 1:3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `exdent` must be a positive scalar numeric representable as integer. Calls: unitize_dir ... strwrap2_ctl -> VAL_WRAP_IN_ENV -> is_scl_int_pos -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, prefix = 1:3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `prefix` must be a scalar character. Calls: unitize_dir ... strwrap_ctl -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, initial = 1:3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `initial` must be a scalar character. Calls: unitize_dir ... strwrap_ctl -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, warn = NULL) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `warn` must be TRUE or FALSE. Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, term.cap = 1:3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `term.cap` must be character. Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, term.cap = "bananas") Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `term.cap` may only contain values in c("all", "bright", "256", "truecolor", "old") Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, ctl = 1:3) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `ctl` must be character. Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, ctl = "bananas") Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `ctl` may contain only values in `c("all", "nl", "c0", "sgr", "csi", "esc", "url", "osc")` Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, wrap.always = 1:3) Error in strwrap2_ctl(hello2.0, wrap.always = 1:3) : Argument `wrap.always` must be TRUE or FALSE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: strwrap2_ctl(hello2.0, wrap.always = NA) Error in strwrap2_ctl(hello2.0, wrap.always = NA) : Argument `wrap.always` must be TRUE or FALSE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = NA) Error in strwrap2_ctl(hello2.0, tabs.as.spaces = NA) : Argument `tabs.as.spaces` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = 1) [1] "hello \033[31mworld \033[42m this is a lovely\033[0mday." 14/14 wrap.R: strwrap2_ctl(hello2.0, tab.stops = -(1:3)) Error in strwrap2_ctl(hello2.0, tab.stops = -(1:3)) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, tab.stops = 0) Error in strwrap2_ctl(hello2.0, tab.stops = 0) : Argument `tab.stops` must be numeric, strictly positive, and representable as an integer. Calls: unitize_dir ... eval -> withVisible -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, strip.spaces = 1:3) Error in strwrap2_ctl(hello2.0, strip.spaces = 1:3) : Argument `strip.spaces` must be TRUE or FALSE. Calls: unitize_dir ... eval -> withVisible -> strwrap2_ctl -> VAL_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, tabs.as.spaces = TRUE, strip.spaces = TRUE) Error in strwrap2_ctl(hello2.0, tabs.as.spaces = TRUE, strip.spaces = TRUE) : `tabs.as.spaces` and `strip.spaces` should not both be TRUE. Calls: unitize_dir ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl 14/14 wrap.R: strwrap2_ctl(hello2.0, pad.end = letters) Error in strwrap2_ctl(hello2.0, pad.end = letters) : Argument `pad.end` must be a scalar character. Calls: unitize_dir ... withVisible -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: bytes <- "\xf0\xe3" 14/14 wrap.R: Encoding(bytes) <- "bytes" 14/14 wrap.R: strwrap_ctl(hello2.0, prefix = bytes) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `prefix` cannot be "bytes" encoded. Calls: unitize_dir ... strwrap_ctl -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(hello2.0, initial = bytes) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `initial` cannot be "bytes" encoded. Calls: unitize_dir ... strwrap_ctl -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap2_ctl(hello2.0, pad.end = bytes) Error in strwrap2_ctl(hello2.0, pad.end = bytes) : Argument `pad.end` cannot be "bytes" encoded. Calls: unitize_dir ... withVisible -> strwrap2_ctl -> VAL_WRAP_IN_ENV -> stop2 14/14 wrap.R: strwrap_ctl(c(hello2.0, bytes)) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a "bytes" encoded string at index [2], which is disallowed. Calls: unitize_dir ... withVisible -> strwrap_ctl -> strwrap2_ctl -> VAL_IN_ENV -> stop2 Prepping Unitizers... Warning in history_capt(history, interactive.mode) : Unable to capture history in non-interactive mode. | Summary of files in common directory 'unitizer': | | Pass Fail | 1. has.R 32 - | 2. interactions.R 93 - | 3. misc.R 107 - | 4. nchar.R 48 - | 5. normalize.R 47 - | 6. overflow.R 56 - | 7. strip.R 99 - | 8. strsplit.R 38 - | 9. substr.R 219 - | 10. tabs.R 16 - | 11. tohtml.R 68 - | 12. trimws.R 12 - | 13. url.R 50 - | 14. wrap.R 141 - | .............................. | 1026 - | 1026/1026 tests passed; nothing to review. Preloads... Loading unitizer data... Parsing tests... Parsing special/utf8.R Evaluating tests... library(fansi) unitizer_sect("substr", { term.cap <- c("bright", "256", "truecolor") lorem.cn.pieces <- substr(rep(lorem.cn, 5), c(1, 11, 21, 31), lorem.cn.col.1 <- paste0(red, lorem.cn.pieces[1], inv, lorem.cn.pieces[2], lor.cn.c.1.5 <- rep(lorem.cn.col.1, 5) starts <- seq(1, 17, 4) ends <- starts + 3 substr2_ctl(lor.cn.c.1.5, starts, ends, term.cap = term.cap) [1] "\033[31m中華人民\033[0m" [2] "\033[31m共和國是\033[0m" [3] "\033[31m單一\033[7m制的\033[0m" [4] "\033[7;31m多民族\033[42m劃\033[0m" [5] "\033[7;31;42m分\033[4;38;2;0;120;200m台灣省\033[0m" lorem.cn.col.2 <- paste0(red, lorem.cn.pieces[1], "hello", inv, lor.cn.c.2.5 <- rep(lorem.cn.col.2, 5) starts <- seq(1, by = 6, length.out = 5) ends <- starts + 5 substr2_ctl(lor.cn.c.2.5, starts, ends, term.cap = term.cap) [1] "\033[31m中華人民共和\033[0m" [2] "\033[31m國是單一he\033[0m" [3] "\033[31mllo\033[7m制的多\033[0m" [4] "\033[7;31m民族 the\033[0m" [5] "\033[7;31mre \033[42m劃分\033[4;38;2;0;120;200m台\033[0m" substr2_sgr(lor.cn.c.2.5, starts, ends, term.cap = term.cap) [1] "\033[31m中華人民共和\033[0m" [2] "\033[31m國是單一he\033[0m" [3] "\033[31mllo\033[7m制的多\033[0m" [4] "\033[7;31m民族 the\033[0m" [5] "\033[7;31mre \033[42m劃分\033[4;38;2;0;120;200m台\033[0m" starts <- seq(1, by = 12, length.out = 5) ends <- starts + 11 substr2_ctl(lor.cn.c.2.5, starts, ends, type = "width", term.cap = term.cap) [1] "\033[31m中華人民共和\033[0m" [2] "\033[31m國是單一hell\033[0m" [3] "\033[31mo\033[7m制的多民族 \033[0m" [4] "\033[7;31mthere \033[42m劃分\033[4;38;2;0;120;200m台\033[0m" [5] "\033[4;7;38;2;0;120;200;42m灣省并沒有實\033[0m" lorem.cn.col.4 <- paste0(red, lorem.cn.pieces[1], "hello", inv, lor.cn.c.4.5 <- rep(lorem.cn.col.4, 5) substr2_ctl(lor.cn.c.4.5, starts, ends, type = "width") [1] "\033[31m中華人民共和\033[0m" [2] "\033[31m國是單一hell\033[0m" [3] "\033[31mo\033[7m制的多民族 \033[0m" [4] "\033[7;31mthere \033[42m劃分\033[4;38;5;141m台\033[0m" [5] "\033[4;7;38;5;141;42m灣省并沒有實\033[0m" lorem.cn.col.3 <- paste0(red, lorem.cn.pieces[1], "helloo", inv, lor.cn.c.3.5 <- rep(lorem.cn.col.3, 5) starts <- seq(1, by = 12, length.out = 5) ends <- starts + 10 ends[2] <- 24 substr2_ctl(lor.cn.c.3.5, starts, ends, type = "width", term.cap = term.cap) [1] "\033[31m中華人民共\033[0m" [2] "\033[31m國是單一hell\033[0m" [3] "\033[31moo\033[7m制的多民\033[0m" [4] "\033[7;31m world! \033[42m劃\033[0m" [5] "\033[4;7;38;2;0;120;200;42m台灣省并沒\033[0m" substr2_ctl(lor.cn.c.3.5, starts, ends, type = "width", round = "both", [1] "\033[31m中華人民共和\033[0m" [2] "\033[31m國是單一hell\033[0m" [3] "\033[31moo\033[7m制的多民族\033[0m" [4] "\033[7;31m world! \033[42m劃分\033[0m" [5] "\033[4;7;38;2;0;120;200;42m台灣省并沒有\033[0m" starts <- seq(1, by = 7, length.out = 5) ends <- starts + 8 substr2_ctl(lor.cn.c.1.5, starts, ends, type = "width", term.cap = term.cap) [1] "\033[31m中華人民\033[0m" [2] "\033[31m民共和國是\033[0m" [3] "\033[31m是單一\033[7m制\033[0m" [4] "\033[7;31m制的多民族\033[0m" [5] "\033[7;31m族\033[42m劃分\033[4;38;2;0;120;200m台\033[0m" substr2_ctl(lor.cn.c.1.5, starts, ends, type = "width", round = "stop", [1] "\033[31m中華人民共\033[0m" [2] "\033[31m共和國是\033[0m" [3] "\033[31m是單一\033[7m制的\033[0m" [4] "\033[7;31m的多民族\033[0m" [5] "\033[7;31m族\033[42m劃分\033[4;38;2;0;120;200m台灣\033[0m" bytes <- "\xc0\xb1\xf0\xb1\xc0\xb1\xc0\xb1" Encoding(bytes) <- "bytes" tce(substr_ctl(bytes, 2, 3)) [1] "Argument `x` contains a \"bytes\" encoded string at index [1], which is disallowed." latin <- "H\xe9llo W\xd6rld!" Encoding(latin) <- "latin1" latin.utf8 <- substr_ctl(latin, 1, 9) latin.utf8 [1] "Héllo WÖr" Encoding(latin.utf8) [1] "UTF-8" rnd.1 <- "MnW" Encoding(rnd.1) <- "UTF-8" substr2_ctl(rnd.1, 2, 4, type = "width", round = "start") [1] "Mn" substr2_ctl(rnd.1, 2, 4, type = "width", round = "stop") [1] "nW" substr2_ctl(rnd.1, 2, 4, type = "width", round = "neither") [1] "n" substr2_ctl(rnd.1, 2, 4, type = "width", round = "both") [1] "MnW" rnd.2 <- "MW" Encoding(rnd.2) <- "UTF-8" substr2_ctl(rnd.2, 2, 3, type = "width", round = "start") [1] "M" substr2_ctl(rnd.2, 2, 3, type = "width", round = "stop") [1] "W" substr2_ctl(rnd.2, 1, 2, type = "width", round = "start") [1] "M" substr2_ctl(rnd.2, 1, 2, type = "width", round = "stop") [1] "M" substr2_ctl(rnd.2, 3, 4, type = "width", round = "start") [1] "W" substr2_ctl(rnd.2, 3, 4, type = "width", round = "stop") [1] "W" unitizer_sect("rounding", { substr2_ctl(lorem.cn.col.2, 1, 2, type = "width") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 1, 3, type = "width") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 2, 3, type = "width") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 2, 4, type = "width") [1] "\033[31m中華\033[0m" substr2_ctl(lorem.cn.col.2, 3, 4, type = "width") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "stop") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "stop") [1] "\033[31m中華\033[0m" substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "stop") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "stop") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "stop") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "both") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "both") [1] "\033[31m中華\033[0m" substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "both") [1] "\033[31m中華\033[0m" substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "both") [1] "\033[31m中華\033[0m" substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "both") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 1, 2, type = "width", round = "neither") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 1, 3, type = "width", round = "neither") [1] "\033[31m中\033[0m" substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "neither") [1] "" substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "neither") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "neither") [1] "\033[31m華\033[0m" substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "neither", [1] "\033[31m" unitizer_sect("multi-elem", { lor.cn.2.2 <- rep(lorem.cn.col.2, 2) substr2_ctl(lor.cn.2.2, c(1, 3), c(2, 4), type = "width") [1] "\033[31m中\033[0m" "\033[31m華\033[0m" substr2_ctl(lor.cn.2.2, c(2, 4), c(2, 4), type = "width") [1] "\033[31m中\033[0m" "\033[31m華\033[0m" unitizer_sect("zero width combining", { combo <- "hellò͜ world" Encoding(combo) <- "UTF-8" substr2_ctl(combo, 1, 5, type = "width") [1] "hellò͜" substr2_ctl(combo, 5, 8, type = "width") [1] "ò͜ wo" substr2_ctl(rep(combo, 2), c(1, 5), c(5, 8), type = "width") [1] "hellò͜" "ò͜ wo" nchar_ctl(combo, type = "width") [1] 11 nchar_ctl(combo, type = "graphemes") [1] 11 combo3 <- paste0(substr(lorem.cn.pieces[1], 1, 2), "̀") Encoding(combo3) <- "UTF-8" substr2_ctl(combo3, 3, 4, type = "width") [1] "華̀" substr2_ctl(combo3, 2, 4, type = "width") [1] "中華̀" substr2_ctl(combo3, 4, 4, type = "width") [1] "華̀" substr2_ctl(combo3, 4, 5, type = "width") [1] "華̀" combo4 <- paste0("̀hello") substr2_ctl(combo4, 1, 1, type = "width") [1] "h" substr2_ctl(combo4, 1, 1) [1] "̀" substr2_ctl(combo4, 0, 1, type = "width") [1] "̀h" substr2_ctl(combo4, 0, 0, type = "width") [1] "" unitizer_sect("Corner cases", { utf8.bad <- "hello \xf0 world, goodnight moon" Encoding(utf8.bad) <- "UTF-8" substr_ctl(utf8.bad, 1, 7) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal substr_ctl(utf8.bad, 5, 10) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal tce(substr2_ctl(utf8.bad, 1, 7, type = "width")) [1] "Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`." tce(substr2_ctl(utf8.bad, 5, 10, type = "width")) [1] "Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`." chrs.2 <- "hello\xee" Encoding(chrs.2) <- "UTF-8" tce(substr2_ctl(chrs.2, 1, 10, type = "width")) [1] "Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`." bad.u <- c("A\033[31;\x80mB", "A\033[31;\x80pB") Encoding(bad.u) <- "UTF-8" substr_ctl(bad.u[1], 0, 3) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains an illegal non-ASCII byte at index [1], see `?unhandled_ctl`. Calls: unitize ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal substr_ctl(bad.u[2], 0, 3) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains an illegal non-ASCII byte at index [1], see `?unhandled_ctl`. Calls: unitize ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal b.test <- c("샶뻙", ("́a뻙"), ("뻙́a"), ("뻙á")) identical(substr_ctl(b.test, 0, 3), substr(b.test, 0, 3)) [1] TRUE identical(substr_ctl(b.test, 0, 2), substr(b.test, 0, 2)) [1] TRUE identical(substr_ctl(b.test, 1, 2), substr(b.test, 1, 2)) [1] TRUE identical(substr_ctl(b.test, 0, 4), substr(b.test, 0, 4)) [1] TRUE identical(substr_ctl(b.test, 4, 4), substr(b.test, 4, 4)) [1] TRUE b.t.c <- sprintf("\033[43m%s\033[49m", b.test) substr_ctl(b.t.c, 0, 0) [1] "" "" "" "" substr_ctl(b.t.c, 0, 2) [1] "\033[43m샶뻙\033[0m" "\033[43ḿa\033[0m" "\033[43m뻙́\033[0m" [4] "\033[43m뻙a\033[0m" substr_ctl(b.t.c, 1, 2) [1] "\033[43m샶뻙\033[0m" "\033[43ḿa\033[0m" "\033[43m뻙́\033[0m" [4] "\033[43m뻙a\033[0m" substr_ctl(b.t.c, 0, 4) [1] "\033[43m샶뻙\033[0m" "\033[43ḿa뻙\033[0m" "\033[43m뻙́a\033[0m" [4] "\033[43m뻙á\033[0m" substr_ctl(b.t.c, 4, 4) [1] "" "" "" "" substr2_ctl(b.t.c, 0, 0, type = "width") [1] "" "" "" "" substr2_ctl(b.t.c, 0, 2, type = "width") [1] "\033[43m샶\033[0m" "\033[43ḿa\033[0m" "\033[43m뻙́\033[0m" [4] "\033[43m뻙\033[0m" substr2_ctl(b.t.c, 1, 4, type = "width") [1] "\033[43m샶뻙\033[0m" "\033[43ma뻙\033[0m" "\033[43m뻙́a\033[0m" [4] "\033[43m뻙á\033[0m" substr2_ctl(b.t.c, 0, 5, type = "width") [1] "\033[43m샶뻙\033[0m" "\033[43ḿa뻙\033[0m" "\033[43m뻙́a\033[0m" [4] "\033[43m뻙á\033[0m" substr2_ctl(b.t.c, 5, 5, type = "width") [1] "" "" "" "" substr_ctl(b.t.c, 0, 4, terminate = FALSE) [1] "\033[43m샶뻙\033[49m" "\033[43ḿa뻙\033[49m" "\033[43m뻙́a\033[49m" [4] "\033[43m뻙á\033[49m" substr2_ctl(b.t.c, 1, 4, terminate = FALSE, type = "width") [1] "\033[43m샶뻙" "\033[43ma뻙\033[49m" "\033[43m뻙́a\033[49m" [4] "\033[43m뻙á\033[49m" unitizer_sect("nchar", { chr.dia <- "Å" nchar_ctl(chr.dia) [1] 2 nchar(chr.dia) [1] 2 nchar_ctl(chr.dia, type = "width") [1] 1 w1 <- "一丁七" w2 <- "一丁七" nchar_ctl(w1) [1] 3 nchar_ctl(w2, type = "width") [1] 6 nchar_ctl(w2, type = "graphemes") [1] 3 nchar_ctl(w2, type = "bytes") [1] 9 hello.illegal <- c("hello", "\xf0", "\xf0aaaa") Encoding(hello.illegal) <- "UTF-8" nchar_ctl(hello.illegal) Error in nchar_ctl_internal(x = x, type.int = TYPE.INT, allowNA = allowNA, : Argument `x` contains a malformed UTF-8 sequence at index [2], see `?unhandled_ctl`. Calls: unitize ... eval -> withVisible -> nchar_ctl -> nchar_ctl_internal nchar_ctl(hello.illegal, allowNA = TRUE) [1] 5 NA NA nzchar_ctl(hello.illegal) [1] TRUE TRUE TRUE esc.1 <- sprintf("hello \033[31mworld\033[m%s\033[48;5;123m blahs \033[m%s", Encoding(esc.1) <- "UTF-8" nchar_ctl(esc.1) [1] 23 nchar_ctl(esc.1, type = "width") [1] 28 nchar_ctl(esc.1, type = "bytes") [1] 33 nzchar_ctl(esc.1) [1] TRUE esc.2 <- "\n\r\033P\033[31m\a" nchar_ctl(c(esc.1, esc.2, "hello"), warn = FALSE) [1] 23 0 5 esc.4 <- c(sprintf("\033[31m%shello", w1), NA, hello.illegal) nchar_sgr(esc.4, type = "width", keepNA = FALSE, warn = FALSE, [1] 11 2 5 NA NA nzchar_sgr(esc.4, keepNA = FALSE, warn = FALSE) [1] TRUE TRUE TRUE TRUE TRUE nchar_sgr("\033[31m\thello", type = "width") >= nchar_ctl("\033[31m\thello", [1] TRUE ncb <- c("123\033[31\x80m123", "123\033\x80123") Encoding(ncb) <- "UTF-8" nchar_ctl(ncb) [1] 6 6 unitizer_sect("unhandled", { utf8.bad.0 <- "hello\033\033\033[45p \xf0how wor\ald" Encoding(utf8.bad.0) <- "UTF-8" unhandled_ctl(utf8.bad.0) index start stop error translated esc 1 1 6 7 malformed-ESC FALSE \033\033 2 1 8 12 non-SGR/hyperlink FALSE \033[45p 3 1 14 14 malformed-UTF8 FALSE \xf0 4 1 22 22 C0 FALSE \a utf8.bad.1 <- "hello \xf0ho" Encoding(utf8.bad.1) <- "UTF-8" unhandled_ctl(utf8.bad.1) index start stop error translated esc 1 1 7 7 malformed-UTF8 FALSE \xf0 unitizer_sect("utf8clen", { chrs <- c("\u0080", "߿", "ࠀ", "\u0fff", "က", "쿿", "퀀", Encoding(chrs) <- "UTF-8" nchar(chrs, allowNA = TRUE) [1] 1 1 1 1 1 1 1 1 1 1 1 1 NA NA NA NA nchar_ctl(chrs, allowNA = TRUE) [1] 1 1 1 1 1 1 1 1 1 1 1 1 NA NA NA NA utf8.bad.2 <- "\xbfaaaaaa" Encoding(utf8.bad.2) <- "UTF-8" nchar(utf8.bad.2, allowNA = TRUE) [1] NA nchar_ctl(utf8.bad.2, allowNA = TRUE) [1] NA substr_ctl(utf8.bad.2, 1, 1) Error in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... withVisible -> substr_ctl -> substr2_ctl -> substr_ctl_internal unitizer_sect("wrap corner cases", { pre.2 <- "\033[32mП \033[0m" ini.2 <- "\033[33mр \033[0m" hello.8c <- "hello Привет world" Encoding(pre.2) <- "UTF-8" Encoding(ini.2) <- "UTF-8" Encoding(hello.8c) <- "UTF-8" pre.3 <- "П " ini.3 <- "р " Encoding(pre.3) <- "UTF-8" Encoding(ini.3) <- "UTF-8" wrap.csi.4 <- strwrap_ctl(hello.8c, 15, prefix = pre.2, initial = ini.2) wrap.csi.4 [1] "\033[33mр \033[0mhello Привет" "\033[32mП \033[0mworld" utf8.chr <- "直" strwrap2_ctl(utf8.chr, 1, wrap.always = TRUE) Error in strwrap2_ctl(utf8.chr, 1, wrap.always = TRUE) : Width must be at least 2 in `wrap.always` mode. Calls: unitize ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl strwrap2_ctl(utf8.chr, 2, wrap.always = TRUE) Error in strwrap2_ctl(utf8.chr, 2, wrap.always = TRUE) : Wrap error: trying to wrap to width narrower than character width; set `wrap.always=FALSE` to resolve. Calls: unitize ... withCallingHandlers -> eval -> eval -> withVisible -> strwrap2_ctl strwrap2_ctl(utf8.chr, 3, wrap.always = TRUE) [1] "直" strwrap_ctl("lovelyday.", 10) [1] "lovelyday." strwrap2_ctl("lovelyday.", 10, wrap.always = TRUE) [1] "lovelyday" "." utf8.bad <- "hello \xf0 world, goodnight moon" Encoding(utf8.bad) <- "UTF-8" strwrap_ctl(utf8.bad, 10) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... eval -> eval -> withVisible -> strwrap_ctl -> strwrap2_ctl utf8.bad.2 <- "\xf0" Encoding(utf8.bad.2) <- "UTF-8" tcw(strwrap_ctl("hello world", 6, prefix = utf8.bad.2)) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `prefix` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... tryCatchOne -> doTryCatch -> strwrap_ctl -> strwrap2_ctl suppressWarnings(strwrap_ctl("hello world", 6, prefix = utf8.bad.2)) Error in strwrap2_ctl(x = x, width = width, indent = indent, exdent = exdent, : Argument `prefix` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`. Calls: unitize ... doWithOneRestart -> withCallingHandlers -> eval -> eval -> withVisible bytes <- "\xc0\xb1\xf0\xb1\xc0\xb1\xc0\xb1" Encoding(bytes) <- "bytes" tce(strwrap_ctl(bytes)) [1] "Argument `x` contains a \"bytes\" encoded string at index [1], which is disallowed." encstrings <- c("hellø world", "hello wørld") Encoding(strwrap_ctl(encstrings, 5)) [1] "UTF-8" "unknown" "unknown" "UTF-8" str.inf <- "😀 😀" strwrap2_ctl(str.inf, 2) [1] "😀" "😀" unitizer_sect("wrap with wide UTF8 and ESC", { wrap.mix <- strwrap_ctl(lorem.mix, 25) wrap.mix [1] "lorem ipsum dolor" [2] "\033[32m個直轄市和 中华 中華人\033[0m" [3] "\033[1;7;32msit amet consectetur\033[0m" [4] "\033[1;7;32madipiscing elit sed do\033[0m" [5] "" [6] "\033[1;7;38;5;105meiusmod tempor\033[0m" [7] "\033[1;7;38;5;105mincididunt ut labore et\033[0m" [8] "\033[1;7;38;5;105mdolore magna aliqua ut\033[0m" [9] "" [10] "個自治區 全國劃 中華" [11] "\033[34;43menim ad minim veniam\033[0m" [12] "\033[34;43mquis\033[49mnostrud exercitation\033[0m" [13] "\033[34mullamco laboris nisi\033[0m" [14] "\033[4m维吾尔族 滿族 蒙古\033[0m" [15] "" [16] "\033[4m藏族 朝鲜族等 主要宗教有\033[0m" [17] "\033[4mut aliquip ex ea commodo\033[0m" [18] "\033[4mconsequat\033[0m" string <- "\033[37;48;5;32m國官方認定的民族現有56個\033[39;49m" Encoding(string) <- "UTF-8" strwrap2_ctl(string, 24, wrap.always = TRUE, pad.end = " ") [1] "\033[37;48;5;32m國官方認定的民族現有56 \033[0m" [2] "\033[37;48;5;32m個\033[39;49m " unitizer_sect("issue 54 ctd", { string3 <- c("\033[38;5;246m# … with 5 more variables: total_time \033[3m\033[38 Encoding(string3) <- "UTF-8" fansi::sgr_to_html(html_esc(string3)) [1] "# … with 5 more variables: total_time <bch:tm>, result <list>, memory <list>," [2] "# time <list>, gc <list>" string4 <- c("wow \033[31m then", "hello\033[\x80;wow", "yo \033[m there", Encoding(string4) <- "UTF-8" sgr_to_html(string4) Error in to_html_int(x = x, warn = warn, term.cap = term.cap, classes = classes, : Argument `x` contains an illegal non-ASCII byte at index [2], see `?unhandled_ctl`. Calls: unitize ... eval -> eval -> withVisible -> sgr_to_html -> to_html_int unitizer_sect("html_esc", { x <- "😀" html_esc(c("h&e'l\"lo", "wors", NA, ""), x) Error in html_esc(c("h&e'l\"lo", "wors", NA, ""), x) : Argument `what` may only contain ASCII characters "&", "<", ">", "'", or "\"". Calls: unitize ... withCallingHandlers -> eval -> eval -> withVisible -> html_esc Prepping Unitizers... Warning in history_capt(history, interactive.mode) : Unable to capture history in non-interactive mode. | 125/125 tests passed; nothing to review. Preloads... Loading unitizer data... Parsing tests... Parsing special/emo-graph.R Evaluating tests... library(fansi) unitizer_sect("Emoji combining", { flags <- "🇦🇷🇦🇴🇦🇮" nchar(flags, type = "chars") [1] 6 nchar(flags, type = "width") [1] 6 nchar_ctl(flags, type = "chars") [1] 6 nchar_ctl(flags, type = "width") [1] 6 nchar(substr2_ctl(flags, 1, 2)) [1] 2 nchar(substr2_ctl(flags, 1, 2, type = "width")) [1] 2 unitizer_sect("graphemes", { flags <- paste0(rep("🇦🇿🇧🇾🇨🇽", 2), collapse = "") strwrap2_ctl(flags, 6, wrap.always = TRUE, pad.end = " ", carry = "\033[44m") [1] "\033[44m🇦🇿🇧🇾 \033[0m" "\033[44m🇨🇽🇦🇿 \033[0m" "\033[44m🇧🇾🇨🇽 \033[0m" strwrap2_ctl(flags, 7, wrap.always = TRUE, pad.end = " ", carry = "\033[44m") [1] "\033[44m🇦🇿🇧🇾🇨🇽\033[0m" "\033[44m🇦🇿🇧🇾🇨🇽\033[0m" flags.1 <- paste0("a", flags) strwrap2_ctl(flags.1, 7, wrap.always = TRUE, pad.end = " ", carry = "\033[44m") [1] "\033[44ma🇦🇿🇧🇾 \033[0m" "\033[44m🇨🇽🇦🇿🇧🇾\033[0m" "\033[44m🇨🇽 \033[0m" substr2_ctl(flags, 1, 1, type = "width") [1] "" substr2_ctl(flags, 1, 1, type = "width", round = "stop") [1] "🇦🇿" substr2_ctl(flags, 1, 2, type = "width", round = "neither") [1] "🇦🇿" substr2_ctl(flags, 2, 3, type = "width", round = "stop") [1] "🇧🇾" substr2_ctl(flags, 2, 3, type = "width", round = "start") [1] "🇦🇿" substr2_ctl(flags, 2, 3, type = "width", round = "both") [1] "🇦🇿🇧🇾" substr2_ctl(flags, 2, 3, type = "width", round = "neither") [1] "" emo.0 <- "👶🏽👨🏿👮🏿" emo.1 <- "A_👨🏾‍🦳_B" emo.2 <- "👨🏾‍🦳" emo.2a <- paste0("_", emo.2, "^", emo.2) nchar_ctl(c(emo.0, emo.1, emo.2), type = "width") [1] 6 6 2 nchar_ctl(c(emo.0, emo.1, emo.2), type = "graphemes") [1] 3 5 1 substr2_ctl(emo.0, 1, 1, type = "width") [1] "" substr2_ctl(emo.0, 1, 1, type = "width", round = "stop") [1] "👶🏽" substr2_ctl(emo.0, 1, 2, type = "width", round = "stop") [1] "👶🏽" substr2_ctl(emo.0, 2, 3, type = "width", round = "stop") [1] "👨🏿" substr2_ctl(emo.0, 2, 3, type = "width", round = "start") [1] "👶🏽" substr2_ctl(emo.0, 2, 3, type = "width", round = "both") [1] "👶🏽👨🏿" substr2_ctl(emo.0, 2, 3, type = "width", round = "neither") [1] "" substr2_ctl(emo.1, 1, 3, type = "width") [1] "A_" substr2_ctl(emo.1, 1, 3, type = "width", round = "stop") [1] "A_👨🏾‍🦳" substr2_ctl(emo.1, 3, 5, type = "width") [1] "👨🏾‍🦳_" substr2_ctl(emo.1, 4, 5, type = "width") [1] "👨🏾‍🦳_" emo.3 <- "👩🏽‍✈️" emo.4 <- "👨‍👩‍👧‍👦" emo.big <- rep(sprintf(paste0("once upon a time %s there was a humpty %s%s dumpt strwrap2_ctl(emo.big, 10, wrap.always = TRUE, carry = "\033[44m", [1] "\033[44monce upon\033[0m" "\033[44ma time \033[0m" [3] "\033[44m🇦🇿🇧🇾🇨🇽🇦🇿 \033[0m" "\033[44m🇧🇾🇨🇽 \033[0m" [5] "\033[44mthere was\033[0m" "\033[44ma humpty \033[0m" [7] "\033[44m👶🏽👨🏿👮🏿👶🏽 \033[0m" "\033[44m👨🏿👮🏿 \033[0m" [9] "\033[44mdumpty \033[0m" "\033[44mA_👨🏾‍🦳_B on\033[0m" [11] "\033[44mthe wall \033[0m" "\033[44m👨🏾‍🦳and he \033[0m" [13] "\033[44mhad 👩🏽‍✈️ a \033[0m" "\033[44m👨‍👩‍👧‍👦 big \033[0m" [15] "\033[44mfall 👩🏽‍✈️ \033[0m" "\033[44moh no 👨🏾‍🦳 \033[0m" [17] "\033[44monce upon\033[0m" "\033[44ma time \033[0m" [19] "\033[44m🇦🇿🇧🇾🇨🇽🇦🇿 \033[0m" "\033[44m🇧🇾🇨🇽 \033[0m" [21] "\033[44mthere was\033[0m" "\033[44ma humpty \033[0m" [23] "\033[44m👶🏽👨🏿👮🏿👶🏽 \033[0m" "\033[44m👨🏿👮🏿 \033[0m" [25] "\033[44mdumpty \033[0m" "\033[44mA_👨🏾‍🦳_B on\033[0m" [27] "\033[44mthe wall \033[0m" "\033[44m👨🏾‍🦳and he \033[0m" [29] "\033[44mhad 👩🏽‍✈️ a \033[0m" "\033[44m👨‍👩‍👧‍👦 big \033[0m" [31] "\033[44mfall 👩🏽‍✈️ \033[0m" "\033[44moh no 👨🏾‍🦳 \033[0m" emo.6 <- c(emo.0, emo.2a, emo.4) substr2_ctl(emo.6, 1, 2, type = "graphemes") [1] "👶🏽👨🏿" "_👨🏾‍🦳" "👨‍👩‍👧‍👦" substr2_ctl(emo.6, 1, 3, type = "graphemes") [1] "👶🏽👨🏿👮🏿" "_👨🏾‍🦳^" "👨‍👩‍👧‍👦" substr2_ctl(emo.6, 2, 3, type = "graphemes") [1] "👨🏿👮🏿" "👨🏾‍🦳^" "" substr2_ctl(emo.6, 3, 3, type = "graphemes") [1] "👮🏿" "^" "" emo.5 <- "👶\033[43m🏽###\033[m" Encoding(emo.5) <- "UTF-8" substr2_ctl(emo.5, 1, 2, type = "width") [1] "👶\033[43m🏽\033[0m" substr2_ctl(emo.5, 2, 3, type = "width") [1] "👶\033[43m🏽#\033[0m" nchar_ctl(emo.5, type = "width") [1] 5 nchar_ctl(emo.5, type = "grapheme") [1] 4 emo.0.1 <- paste0("\033[33m", substr2_ctl(emo.0, 1, 1, type = "graphemes"), substr2_ctl(emo.0.1, 2, 2, type = "width") [1] "\033[33m👶🏽\033[0m" substr2_ctl(emo.0.1, 2, 2, type = "width", terminate = FALSE) [1] "\033[33m👶🏽" substr2_ctl(emo.0.1, 1, 1, type = "width", round = "stop") [1] "\033[33m👶🏽\033[0m" substr2_ctl(emo.0.1, 1, 3, type = "width") [1] "\033[33m👶🏽\033[0m" substr2_ctl(emo.0.1, 1, 3, type = "width", terminate = FALSE) [1] "\033[33m👶🏽\033[45m" substr2_ctl(emo.0.1, 1, 3, type = "width", round = "stop") [1] "\033[33m👶🏽\033[0m" emo.0.2 <- paste0(emo.0.1, "\a") substr2_ctl(emo.0.2, 1, 3, type = "width", round = "start") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[33m👶🏽\033[45m\a\033[0m" emo.0.3 <- paste0(emo.0.1, "\a\033]8;;x.yz\033\\") substr2_ctl(emo.0.3, 1, 3, type = "width", round = "start") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033[33m👶🏽\033[45m\a\033[0m" emo.0.4 <- paste0("\033]8;;x.yz\033\\", substr2_ctl(emo.0, 1, substr2_ctl(emo.0.4, 1, 3, type = "width") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;x.yz\033\\👶🏽\033]8;;w.ww\033\\\a\033]8;;\033\\" substr2_ctl(emo.0.4, 1, 3, type = "width", terminate = FALSE) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;x.yz\033\\👶🏽\033]8;;w.ww\033\\\a\033[42m" substr2_ctl(emo.0.4, 1, 2, type = "width", terminate = FALSE) Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;x.yz\033\\👶🏽" substr2_ctl(emo.0.4, 1, 2, type = "width") Warning in substr_ctl_internal(x, start = start, stop = stop, type.int = TYPE.INT, : Argument `x` contains a C0 control character at index [1], see `?unhandled_ctl`; you can use `warn=FALSE` to turn off these warnings. [1] "\033]8;;x.yz\033\\👶🏽\033]8;;\033\\" unitizer_sect("replacement and width", { `substr2_ctl<-`(emo.1, 3, 4, value = emo.0) [1] "A_👶🏽‍🦳_B" `substr2_ctl<-`(emo.1, 3, 4, value = emo.0, type = "width") [1] "A_👶🏽_B" `substr2_ctl<-`(emo.1, 4, 4, value = emo.0, type = "width") [1] "A_👨🏾‍🦳_B" `substr2_ctl<-`(emo.1, 4, 4, value = emo.0, type = "width", round = "stop") [1] "A_👨🏾‍🦳_B" `substr2_ctl<-`(emo.1, 4, 4, value = emo.0, type = "width", round = "neither") [1] "A_👨🏾‍🦳_B" `substr2_ctl<-`(emo.1, 4, 4, value = "#", type = "width") [1] "A_#_B" `substr2_ctl<-`(emo.1, 4, 5, value = emo.0, type = "width") [1] "A_👶🏽_B" x <- "ABCDEF" `substr2_ctl<-`(x, 2, 4, value = emo.0, type = "width") [1] "A👶🏽DEF" `substr2_ctl<-`(x, 2, 4, value = emo.0, type = "width", round = "stop") [1] "A👶🏽DEF" `substr2_ctl<-`(x, 2, 5, value = emo.0, type = "width") [1] "A👶🏽👨🏿F" `substr2_ctl<-`(emo.1, 3, 4, value = emo.0, type = "width", round = "both") [1] "A_👶🏽_B" `substr2_ctl<-`(emo.1, 4, 4, value = emo.0, type = "width", round = "both") [1] "A_👨🏾‍🦳_B" a <- c(rep(emo.1, 4), rep(x, 2)) b <- c(emo.0, "#", rep(emo.0, 4)) starts <- c(3, 4, 4, 4, 2, 2) stops <- c(4, 4, 4, 5, 4, 5) x <- a substr2_ctl(x, starts, stops, type = "width") <- b x [1] "A_👶🏽_B" "A_#_B" "A_👨🏾‍🦳_B" "A_👶🏽_B" "A👶🏽DEF" [6] "A👶🏽👨🏿F" starts <- c(3, 4, 2, 3, 4, 2) ends <- c(8, 9, 7, 7, 8, 6) emo.3 <- rep(paste0("👧🏿🧔🏿", emo.0), length(starts)) emo.4 <- "👩‍🦱🤷👩‍⚕️" x0 <- x1 <- emo.3 substr2_ctl(x0, starts, ends, type = "width") <- emo.4 x0 [1] "👧🏿👩‍🦱🤷👩‍⚕️👮🏿" "👧🏿👩‍🦱🤷👩‍⚕️👮🏿" "👩‍🦱🤷👩‍⚕️👨🏿👮🏿" [4] "👧🏿👩‍🦱🤷👨🏿👮🏿" "👧🏿👩‍🦱🤷👨🏿👮🏿" "👩‍🦱🤷👶🏽👨🏿👮🏿" substr2_ctl(x1, starts, ends, type = "width", round = "stop") <- emo.4 x1 [1] "👧🏿👩‍🦱🤷👩‍⚕️👮🏿" "👧🏿🧔🏿👩‍🦱🤷👩‍⚕️" "👧🏿👩‍🦱🤷👩‍⚕️👮🏿" [4] "👧🏿👩‍🦱🤷👩‍⚕️👮🏿" "👧🏿🧔🏿👩‍🦱🤷👮🏿" "👧🏿👩‍🦱🤷👨🏿👮🏿" emo.7 <- "😀_😀" emo.7a <- "😀" `substr2_ctl<-`(emo.7, 3, 3, type = "width", round = "stop", [1] "😀_😀" `substr2_ctl<-`(emo.7, 3, 3, type = "width", round = "stop", [1] "😀#😀" `substr2_ctl<-`(emo.7a, 2, 1, type = "width", round = "both", [1] "😀" Prepping Unitizers... Warning in history_capt(history, interactive.mode) : Unable to capture history in non-interactive mode. | 68/68 tests passed; nothing to review. > > proc.time() user system elapsed 17.98 0.85 39.20