Inverse Closes colors
bayleedev opened this issue · comments
puts ANSI.yellow{ "Foo" + ANSI.invert{ "∙∙∙" } + "bar" }
You can see the bar
at the end isn't yellow, but you'd expect it to be. I'm using invert
to make whitespace visible in a text based game.
The actual output is:
"\e[33mFoo\e[7m∙∙∙\e[0mbar\e[0m"
Expected:
- "\e[33mFoo\e[7m∙∙∙\e[0mbar\e[0m"
+ "\e[33mFoo\e[7m∙∙∙\e[27mbar\e[0m"
I tried adding a test case, but they don't appear to be passing right now when I run rake test
.
method :invert do
test do
str = ANSI::Code.invert
out = "\e[7m"
out.assert == str
end
test "with block notation" do
str = ANSI::Code.invert { "World" }
out = "\e[7mWorld\e[27m"
out.assert == str
end
end