I'm observing an error with ansi_html() when strings with the same styles have been pasted together. An example:
library("cli")
asf <- combine_ansi_styles(bg_blue, col_br_yellow)
s <- paste(rep_len(asf(" "), 10L), collapse = "")
h_cli <- ansi_html(s)
print(h_cli)
[1] "<span class=\"ansi ansi-color-3 ansi-bg-color-4\"> </span> "
Note only the first space is styled with the correct background color and the remaining nine spaces are unstyled. In contrast I believe the right output should instead be:
[1] "<span class=\"ansi ansi-color-3 ansi-bg-color-4\"> </span>"
(note the different placement of the </span>). In contrast fansi::sgr_to_html() seems to correctly preserve a style for all ten spaces:
h_fansi <- fansi::sgr_to_html(s)
print(h_fansi)
[1] "<span style='color: #FFFF55; background-color: #0000BB;'> </span>"
I'm observing an error with
ansi_html()when strings with the same styles have been pasted together. An example:Note only the first space is styled with the correct background color and the remaining nine spaces are unstyled. In contrast I believe the right output should instead be:
(note the different placement of the
</span>). In contrastfansi::sgr_to_html()seems to correctly preserve a style for all ten spaces: