Skip to content

utf8_encode(escapes = "31") colors escapes and backslashes/quotes differently #34

Description

@krlmlr

This splits the output by opening/closing styling. In the first two examples, only the backslash is colored red. In the third example, \n is colored red.

@patperry: Is this intentional? Should we consistently color all characters in \" and \\ in red?

utf8::utf8_encode(c("\\", '"', "\n"), quote = TRUE, escapes = "31", display = TRUE) |>
  strsplit("\033[[][^m]*m")
#> [[1]]
#> [1] "\""   "\\"   "\\\""
#> 
#> [[2]]
#> [1] "\""   "\\"   "\"\""
#> 
#> [[3]]
#> [1] "\""  "\\n" "\""

Created on 2022-06-30 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions