mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Optimize parse_color
This commit is contained in:
parent
902c6ec4a3
commit
70a1d8314c
|
@ -466,17 +466,14 @@ rgb_color_t parse_color(const env_var_t &var, bool is_background) {
|
||||||
|
|
||||||
std::vector<rgb_color_t> candidates;
|
std::vector<rgb_color_t> candidates;
|
||||||
|
|
||||||
wcstring_list_t el;
|
wcstring color_name;
|
||||||
var.to_list(el);
|
for (const wcstring &next : var.as_list()) {
|
||||||
|
color_name.clear();
|
||||||
for (size_t j = 0; j < el.size(); j++) {
|
|
||||||
const wcstring &next = el.at(j);
|
|
||||||
wcstring color_name;
|
|
||||||
if (is_background) {
|
if (is_background) {
|
||||||
// Look for something like "--background=red".
|
// Look for something like "--background=red".
|
||||||
const wcstring prefix = L"--background=";
|
const wchar_t *prefix = L"--background=";
|
||||||
if (string_prefixes_string(prefix, next)) {
|
if (string_prefixes_string(prefix, next)) {
|
||||||
color_name = wcstring(next, prefix.size());
|
color_name = wcstring(next, wcslen(prefix));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (next == L"--bold" || next == L"-o")
|
if (next == L"--bold" || next == L"-o")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user