aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--src/builtin_set_color.cpp6
-rw-r--r--src/color.cpp18
-rw-r--r--src/color.h15
-rw-r--r--src/output.cpp22
-rw-r--r--src/output.h9
6 files changed, 22 insertions, 50 deletions
diff --git a/.gitignore b/.gitignore
index e0713b06..717e3243 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,5 @@ lexicon.txt
lexicon_filter
lexicon.log
DerivedData/
+compile_commands.json
+xcodebuild.log
diff --git a/src/builtin_set_color.cpp b/src/builtin_set_color.cpp
index b3c7ebaf..449e3895 100644
--- a/src/builtin_set_color.cpp
+++ b/src/builtin_set_color.cpp
@@ -137,7 +137,7 @@ static int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **
for (; w.woptind < argc; w.woptind++)
{
rgb_color_t fg = rgb_color_t(argv[w.woptind]);
- if (fg.is_none() || fg.is_ignore())
+ if (fg.is_none())
{
streams.err.append_format(_(L"%ls: Unknown color '%ls'\n"), argv[0], argv[w.woptind]);
return STATUS_BUILTIN_ERROR;
@@ -155,10 +155,10 @@ static int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **
// #1323: We may have multiple foreground colors. Choose the best one.
// If we had no foreground coor, we'll get none(); if we have at least one we expect not-none
const rgb_color_t fg = best_color(fgcolors, output_get_color_support());
- assert(fgcolors.empty() || !(fg.is_none() || fg.is_ignore()));
+ assert(fgcolors.empty() || !fg.is_none());
const rgb_color_t bg = rgb_color_t(bgcolor ? bgcolor : L"");
- if (bgcolor && (bg.is_none() || bg.is_ignore()))
+ if (bgcolor && bg.is_none())
{
streams.err.append_format(_(L"%ls: Unknown color '%ls'\n"), argv[0], bgcolor);
return STATUS_BUILTIN_ERROR;
diff --git a/src/color.cpp b/src/color.cpp
index 19adc390..4c3c89d2 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -1,6 +1,4 @@
-/** \file color.cpp Color class implementation
-*/
-
+// Color class implementation.
#include "color.h"
#include "fallback.h" // IWYU pragma: keep
#include <assert.h>
@@ -21,10 +19,6 @@ bool rgb_color_t::try_parse_special(const wcstring &special)
{
this->type = type_reset;
}
- else if (! wcscasecmp(name, L"ignore"))
- {
- this->type = type_ignore;
- }
else
{
this->type = type_none;
@@ -240,22 +234,22 @@ rgb_color_t rgb_color_t::normal()
{
return rgb_color_t(type_normal);
}
+
rgb_color_t rgb_color_t::reset()
{
return rgb_color_t(type_reset);
}
-rgb_color_t rgb_color_t::ignore()
-{
- return rgb_color_t(type_ignore);
-}
+
rgb_color_t rgb_color_t::none()
{
return rgb_color_t(type_none);
}
+
rgb_color_t rgb_color_t::white()
{
return rgb_color_t(type_named, 7);
}
+
rgb_color_t rgb_color_t::black()
{
return rgb_color_t(type_named, 0);
@@ -382,8 +376,6 @@ wcstring rgb_color_t::description() const
return L"reset";
case type_normal:
return L"normal";
- case type_ignore:
- return L"ignore";
default:
abort();
return L"";
diff --git a/src/color.h b/src/color.h
index 988bfdb8..1faa35a6 100644
--- a/src/color.h
+++ b/src/color.h
@@ -1,5 +1,4 @@
-/** \file color.h Color class.
- */
+// Color class.
#ifndef FISH_COLOR_H
#define FISH_COLOR_H
@@ -24,8 +23,7 @@ class rgb_color_t
type_named,
type_rgb,
type_normal,
- type_reset,
- type_ignore
+ type_reset
};
unsigned char type:4;
@@ -79,18 +77,9 @@ public:
/** Returns the normal special color */
static rgb_color_t normal();
- /** Returns the ignore special color */
- static rgb_color_t ignore();
-
/** Returns the none special color */
static rgb_color_t none();
- /** Returns whether the color is the ignore special color */
- bool is_ignore(void) const
- {
- return type == type_ignore;
- }
-
/** Returns whether the color is the normal special color */
bool is_normal(void) const
{
diff --git a/src/output.cpp b/src/output.cpp
index dbd97eb4..033d1409 100644
--- a/src/output.cpp
+++ b/src/output.cpp
@@ -246,25 +246,17 @@ void set_color(rgb_color_t c, rgb_color_t c2)
was_underline=0;
}
- if (! last_color2.is_normal() &&
- ! last_color2.is_reset() &&
- ! last_color2.is_ignore())
+ if (!last_color2.is_normal() && !last_color2.is_reset())
{
- /*
- Background was set
- */
- last_bg_set=1;
+ // Background was set.
+ last_bg_set = 1;
}
- if (! c2.is_normal() &&
- ! c2.is_ignore())
+ if (!c2.is_normal())
{
- /*
- Background is set
- */
- bg_set=1;
- if (c==c2)
- c = (c2==rgb_color_t::white())?rgb_color_t::black():rgb_color_t::white();
+ // Background is set.
+ bg_set = 1;
+ if (c == c2) c = (c2==rgb_color_t::white())?rgb_color_t::black():rgb_color_t::white();
}
if ((enter_bold_mode != 0) && (strlen(enter_bold_mode) > 0))
diff --git a/src/output.h b/src/output.h
index 68ad2a2e..acdd2612 100644
--- a/src/output.h
+++ b/src/output.h
@@ -27,9 +27,7 @@ enum
FISH_COLOR_MAGENTA,
FISH_COLOR_CYAN,
FISH_COLOR_WHITE,
- /** The default fg color of the terminal */
- FISH_COLOR_NORMAL,
- FISH_COLOR_IGNORE,
+ FISH_COLOR_NORMAL, // the default fg color of the terminal
FISH_COLOR_RESET
};
@@ -41,9 +39,8 @@ enum
screen to flicker, the function takes care to write as little as
possible.
- Possible values for color are any form the FISH_COLOR_* enum,
- FISH_COLOR_IGNORE and FISH_COLOR_RESET. FISH_COLOR_IGNORE will
- leave the color unchanged, and FISH_COLOR_RESET will perform an
+ Possible values for color are any form the FISH_COLOR_* enum
+ and FISH_COLOR_RESET. FISH_COLOR_RESET will perform an
exit_attribute_mode, even if set_color thinks it is already in
FISH_COLOR_NORMAL mode.