substr2_ctl(lorem.cn.col.2, 2, 4, type = "width", round = "neither")

substr2_ctl(lorem.cn.col.2, 3, 4, type = "width", round = "neither")

substr2_ctl(lorem.cn.col.2, 2, 3, type = "width", round = "neither", 
    terminate = FALSE)

# Due to preservation of state issues, need to make sure works well with
# more than one value

substr2_ctl(lor.cn.2.2, c(1, 3), c(2, 4), type = "width")

substr2_ctl(lor.cn.2.2, c(2, 4), c(2, 4), type = "width")

substr2_ctl(combo, 1, 5, type = "width")

substr2_ctl(combo, 5, 8, type = "width")

substr2_ctl(rep(combo, 2), c(1, 5), c(5, 8), type = "width")

combo3 <- paste0(substr(lorem.cn.pieces[1], 1, 2), "<U+0300>")

substr2_ctl(combo3, 3, 4, type = "width")

substr2_ctl(combo3, 2, 4, type = "width")

substr2_ctl(combo3, 4, 4, type = "width")

substr2_ctl(combo3, 4, 5, type = "width")

substr2_ctl(combo4, 1, 1, type = "width")

substr2_ctl(combo4, 0, 1, type = "width")

substr2_ctl(combo4, 0, 0, type = "width")

utf8.bad <- "hello ð world, goodnight moon"

Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`.

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`.

tce(substr2_ctl(utf8.bad, 1, 7, type = "width"))

# Need to use `tryCatch` because the warnings vascillate for no rhyme or
# reason between showing the call and not.  Seems to be triggered by
# re-installing package. now we're stuck with the try business to circumvent
# that variability.

[1] "Argument `x` contains a malformed UTF-8 sequence at index [1], see `?unhandled_ctl`."

tce(substr2_ctl(utf8.bad, 5, 10, type = "width"))

# # need to remove for changes in R3.6.0
# substr2_ctl(utf8.bad, 1, 7, type='width', warn=FALSE)

# # need to remove for changes in R3.6.0
# substr2_ctl(utf8.bad, 5, 10, type='width', warn=FALSE)
# ends early

tce(substr2_ctl(chrs.2, 1, 10, type = "width"))

# # need to remove for changes in R3.6.0
# substr2_ctl(chrs.2, 1, 10, type='width', warn=FALSE)
# bad utf8 in SGR and CSI