mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
output: A background is set if it's not a special non-color
For reasons unclear to me, fish enables bold mode unconditionally if the background is set. However, this called a background "set" if it wasn't exactly the "normal" color, whereas set_color --print-colors would set a color of *none*. We have three special non-color colors: - "normal" - "reset" - "none" All of these specify some form of absence of background color, so all of them should be checked. Fixes #7805
This commit is contained in:
parent
4218c1f1a4
commit
4762d52e52
2 changed files with 8 additions and 5 deletions
|
@ -179,12 +179,14 @@ void outputter_t::set_color(rgb_color_t fg, rgb_color_t bg) {
|
|||
reset_modes();
|
||||
}
|
||||
|
||||
if (!last_color2.is_normal() && !last_color2.is_reset()) {
|
||||
if (!last_color2.is_special()) {
|
||||
// Background was set.
|
||||
// "Special" here refers to the special "normal", "reset" and "none" colors,
|
||||
// that really jus disable the background.
|
||||
last_bg_set = true;
|
||||
}
|
||||
|
||||
if (!bg.is_normal()) {
|
||||
if (!bg.is_special()) {
|
||||
// Background is set.
|
||||
bg_set = true;
|
||||
if (fg == bg) fg = (bg == rgb_color_t::white()) ? rgb_color_t::black() : rgb_color_t::white();
|
||||
|
|
|
@ -35,9 +35,10 @@ expect_str("bryellow")
|
|||
expect_str("cyan")
|
||||
expect_str("green")
|
||||
expect_str("magenta")
|
||||
expect_str("\x1b[31mred")
|
||||
expect_str("\x1b[37mwhite")
|
||||
expect_str("\x1b[33myellow")
|
||||
# These should be anchored at the beginning of the line, no e.g. bold sequence before.
|
||||
expect_str("\n\x1b[31mred")
|
||||
expect_str("\n\x1b[37mwhite")
|
||||
expect_str("\n\x1b[33myellow")
|
||||
expect_str("normal")
|
||||
expect_prompt()
|
||||
|
||||
|
|
Loading…
Reference in a new issue