onevcat / Rainbow

Delightful console output for Swift developers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Style doesn't get reset for substring

Snowy1803 opened this issue · comments

Hello,

This simple code has an unexpected result:

print(("a" + "b".underline + "c").lightGreen)

I would expect the whole string to be in green, and the b only to be underlined, however the underlining doesn't get reset, so the c gets underlined too!

Expected result: \e[92ma\e[92;4mb\e[0;92mc\e[0m
Actual result: \e[92ma\e[92;4mb\e[92mc\e[0m
abc with both b and c underlined

This happens with all styles when applied to a substring where a foreground color is inherited.

Duplicated to #60, should be fixed in #62

Merged and this should be fixed.