has_sgr: Check for Presence of Control Sequences

View source: R/sgr.R

has_sgrR Documentation

Check for Presence of Control Sequences


This function is deprecated in favor of the has_ctl. It checks for CSI SGR and OSC hyperlink sequences.


has_sgr(x, warn = getOption("fansi.warn", TRUE))



a character vector or object that can be coerced to such.


TRUE (default) or FALSE, whether to warn when potentially problematic Control Sequences are encountered. These could cause the assumptions fansi makes about how strings are rendered on your display to be incorrect, for example by moving the cursor (see ?fansi). At most one warning will be issued per element in each input vector. Will also warn about some badly encoded UTF-8 strings, but a lack of UTF-8 warnings is not a guarantee of correct encoding (use validUTF8 for that).


logical of same length as x; NA values in x result in NA values in return

fansi documentation built on Jan. 23, 2023, 5:28 p.m.