make_ansi_map1: Create a map of the ANSI tags of a single string

Description Usage Arguments Details Value

View source: R/map.R

Description

This map can be then used in various string operations, e.g. ansi_substr(), etc.

Usage

1
2
3

Arguments

str

A string scalar.

Details

make_ansi_map1() works for a string scalar, make_ansi_map() does the same for all strings in a character vector.

Value

A list with two components. map is a data frame with four columns: start, end, open, close. It has one row for each single ANSI markup. In other words, it has one row for each ANSI start tag. The start column contains the start positions (in raw coordinates) of the markup, the end column has the end positions. The open and close columns contain the full ANSI open and close tags.

shifts is a three column matrix that can be used to convert between raw and ANSI coordinates. It is created by make_shifts1(), see that for the actual format.


r-lib/ansistrings documentation built on March 7, 2020, 10:13 p.m.