bg <- ceiling(seq_along(r.thanks)/length(r.thanks) * 215) + 16

## Generate colors from the 256 color palette

r.thanks[nz] <- sprintf(tpl, fg[nz], bg[nz], r.thanks[nz])

r.col <- paste0(r.thanks, collapse = "\n")

r.wrap <- strwrap2_ctl(r.col, 35, pad.end = " ", wrap.always = TRUE)

## Pad paragraph break line when it is colored

strwrap2_ctl(hello.9b, 8, pad.end = " ")

strwrap2_ctl(hello.9b, 8, strip.spaces = FALSE)

strwrap2_sgr(ws.0, 7, strip.spaces = FALSE)

strwrap2_sgr(ws.0, 7, strip.spaces = FALSE, wrap.always = TRUE)

strwrap2_sgr(ws.0, 6, strip.spaces = FALSE)

strwrap2_sgr(ws.0, 6, strip.spaces = FALSE, wrap.always = TRUE)

strwrap2_sgr(ws.1, 7, strip.spaces = FALSE)

strwrap2_sgr(ws.1, 7, strip.spaces = FALSE, wrap.always = TRUE)

strwrap2_sgr(ws.1, 6, strip.spaces = FALSE)

strwrap2_sgr(ws.1, 6, strip.spaces = FALSE, wrap.always = TRUE)

strwrap2_sgr(" hello world ", 7, strip.spaces = FALSE)

strwrap2_sgr("\thello\tworld\t", 7, strip.spaces = FALSE)

strwrap2_sgr("\nhello\nworld\n", 7, strip.spaces = FALSE)

hello.9e <- c("hello\t\033[91mworld\033[m\t\033[38;2;31;42;4mworld boohaythere", 
    "asdfasdfasdfasdf")

strwrap_sgr(hello.9e, 12, term.cap = "256")

## primarily testing that all args are used correctly.

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.

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.

hello.9f <- "hello \033[91mworld boohaythereyowza"

strwrap2_sgr(hello.9f, 12, prefix = "++", initial = ">>", wrap.always = TRUE, 
    pad.end = "~", strip.spaces = FALSE)

strwrap2_sgr(hello.9e, 12, tabs.as.spaces = TRUE, tab.stops = c(6, 
    12), warn = FALSE, indent = 2, exdent = 1, prefix = "++", 
    initial = ">>", term.cap = "256", wrap.always = TRUE, simplify = FALSE, 
    pad.end = "~", strip.spaces = FALSE)