EVOLUTION-MANAGER
Edit File: unhandled_ctl.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Identify Unhandled ANSI Control Sequences</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for unhandled_ctl {fansi}"><tr><td>unhandled_ctl {fansi}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Identify Unhandled ANSI Control Sequences</h2> <h3>Description</h3> <p>Will return position and types of unhandled <em>Control Sequences</em> in a character vector. Unhandled sequences may cause <code>fansi</code> to interpret strings in a way different to your display. See <a href="fansi.html">fansi</a> for details. </p> <h3>Usage</h3> <pre> unhandled_ctl(x, term.cap = getOption("fansi.term.cap")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>character vector</p> </td></tr> <tr valign="top"><td><code>term.cap</code></td> <td> <p>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 <code>fansi</code> interprets escape sequences, so you should ensure that it matches your terminal capabilities. See <a href="term_cap_test.html">term_cap_test</a> for details.</p> </td></tr> </table> <h3>Details</h3> <p>This is a debugging function that is not optimized for speed. </p> <p>The return value is a data frame with five columns: </p> <ul> <li><p> index: integer the index in <code>x</code> with the unhandled sequence </p> </li> <li><p> start: integer the start position of the sequence (in characters) </p> </li> <li><p> stop: integer the end of the sequence (in characters), but note that if there are multiple ESC sequences abutting each other they will all be treated as one, even if some of those sequences are valid. </p> </li> <li><p> error: the reason why the sequence was not handled: </p> <ul> <li><p> exceed-term-cap: contains color codes not supported by the terminal (see <a href="term_cap_test.html">term_cap_test</a>). Bright colors with color codes in the 90-97 and 100-107 range in terminals that do not support them are not considered errors, whereas 256 or truecolor codes in terminals that do not support them are. This is because the latter are often misinterpreted by terminals that do not support them, whereas the former are typically silently ignored. </p> </li> <li><p> special: SGR substring contains uncommon characters in ":<=>". </p> </li> <li><p> unknown: SGR substring with a value that does not correspond to a known SGR code. </p> </li> <li><p> non-SGR: a non-SGR CSI sequence. </p> </li> <li><p> non-CSI: a non-CSI escape sequence, i.e. one where the ESC is followed by something other than "[". Since we assume all non-CSI sequences are only 2 characters long include the ESC, this type of sequence is the most likely to cause problems as many are not actually two characters long. </p> </li> <li><p> malformed-CSI: a malformed CSI sequence. </p> </li> <li><p> malformed-ESC: a malformed ESC sequence (i.e. one not ending in 0x40-0x7e). </p> </li> <li><p> C0: a "C0" control character (e.g. tab, bell, etc.). </p> </li></ul> </li> <li><p> translated: whether the string was translated to UTF-8, might be helpful in odd cases were character offsets change depending on encoding. You should only worry about this if you cannot tie out the <code>start</code>/<code>stop</code> values to the escape sequence shown. </p> </li> <li><p> esc: character the unhandled escape sequence </p> </li></ul> <h3>Value</h3> <p>data frame with as many rows as there are unhandled escape sequences and columns containing useful information for debugging the problem. See details. </p> <h3>Note</h3> <p>Non-ASCII strings are converted to UTF-8 encoding. </p> <h3>See Also</h3> <p><a href="fansi.html">fansi</a> for details on how <em>Control Sequences</em> are interpreted, particularly if you are getting unexpected results. </p> <h3>Examples</h3> <pre> 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) </pre> <hr /><div style="text-align: center;">[Package <em>fansi</em> version 0.4.1 <a href="00Index.html">Index</a>]</div> </body></html>