Can We "Defend Against" Multiple Styles at Once?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start with the style_no_*() functions and combine_ansi_styles() entry points described in the issue, then reproduce the chained examples. Determine whether ANSI sequences can preserve multiple defenses at once; done means the demonstrated italic and strikethrough defenses both remain effective when later styles are applied.
Written by the indexing model from the issue text.
Description
Background
This is a spinoff of my original question on Stack Overflow, regarding the style_no_*() family.
Every
style_*()function has astyle_no_*()pair, which defends its argument from taking on the style.
When applying several style_no_*() functions to text, only the latest (or outermost) "defense" actually succeeds:
"Example text" |>
style_no_strikethrough() |> style_no_italic() |>
style_strikethrough() |> style_italic() |> style_bold()
<cli_ansi_string>
[1]Example text
This is also true for compound styles, via combine_ansi_styles().
sty_0 <- combine_ansi_styles(
style_no_italic,
style_no_strikethrough
)
sty_1 <- combine_ansi_styles(
style_italic,
style_bold,
style_strikethrough
)
"Example text" |> sty_0() |> sty_1()
<cli_ansi_string>
[1]Example text
It seems each defense must be applied immediately before it is needed.
"Example text" |>
style_no_italic() |> style_italic() |>
style_no_strikethrough() |> style_strikethrough() |>
style_bold()
<cli_ansi_string>
[1]Example text
Question
Is this an inherent limitation of ANSI sequences? Or should I request this as a feature? Or is it actually a bug?
Thanks — Greg
- Dominant language
- R
- Stars
- 726
- Forks
- 94
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from r-lib/cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
feature
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
Similar issues
-
documentation pkg infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiverse-trace/epiparameter#511 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
pharmaverse/aNCA#1496 ·
-
function:write_dwc
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Urgent request: Due to vulnerabilities move to API version 12.6.1 (12.6.2 eventually) or 13.1.1 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jbkunst/highcharter#849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·