unhandled_ctl {fansi}R Documentation

Identify Unhandled ANSI Control Sequences

Description

Will return position and types of unhandled Control Sequences in a character vector. Unhandled sequences may cause fansi to interpret strings in a way different to your display. See fansi for details.

Usage

unhandled_ctl(x, term.cap = getOption("fansi.term.cap"))

Arguments

x

character vector

term.cap

character a vector of the capabilities of the terminal, can be any combination "bright" (SGR codes 90-97, 100-107), "256" (SGR codes starting with "38;5" or "48;5"), and "truecolor" (SGR codes starting with "38;2" or "48;2"). Changing this parameter changes how fansi interprets escape sequences, so you should ensure that it matches your terminal capabilities. See term_cap_test for details.

Details

This is a debugging function that is not optimized for speed.

The return value is a data frame with five columns:

Value

data frame with as many rows as there are unhandled escape sequences and columns containing useful information for debugging the problem. See details.

Note

Non-ASCII strings are converted to UTF-8 encoding.

See Also

fansi for details on how Control Sequences are interpreted, particularly if you are getting unexpected results.

Examples

string <- c(
  "\033[41mhello world\033[m", "foo\033[22>m", "\033[999mbar",
  "baz \033[31#3m", "a\033[31k", "hello\033m world"
)
unhandled_ctl(string)

[Package fansi version 0.4.2 Index]