Fastfetch: fix #517

1. Fix specifying `--set-keyless` with the same key second time won't override the value set before
2. Fix specifying `--color` second time won't clear the value set before
This commit is contained in:
李通洲
2023-08-12 09:40:37 +08:00
parent 97b779aefb
commit a87a0470ca
3 changed files with 21 additions and 4 deletions
+2
View File
@@ -47,6 +47,8 @@ Bugfixes:
* Fix option `--title-fqdn` doesn't work (Title)
* Fix used spaces calculation (Disk, Linux / BSD / macOS, #508)
* Fix `--brightness-format` (Brightness)
* Fix specifying `--set-keyless` with the same key second time won't override the value set before (#517)
* Fix specifying `--color` second time won't clear the value set before (#517)
Logo:
* Change the special handling of `kitty` protocol with `.png` image file to a new image protocol `kitty-direct`. This is the fastest image protocol because fastfetch doesn't need to pre-encode the image to base64 or something and the image content doesn't need to be transmitted via tty. Note:
+1
View File
@@ -132,6 +132,7 @@ bool ffOptionParseBoolean(const char* str)
void ffOptionParseColor(const char* value, FFstrbuf* buffer)
{
ffStrbufClear(buffer);
ffStrbufEnsureFree(buffer, 63);
while(*value != '\0')
+18 -4
View File
@@ -861,10 +861,24 @@ static void parseOption(FFdata* data, const char* key, const char* value)
fprintf(stderr, "Error: usage: %s <key>=<str>\n", key);
exit(477);
}
FFCustomValue* customValue = (FFCustomValue*) ffListAdd(&data->customValues);
ffStrbufInitS(&customValue->value, &customValueStr.chars[index + 1]);
ffStrbufSubstrBefore(&customValueStr, index);
ffStrbufInitMove(&customValue->key, &customValueStr);
FF_STRBUF_AUTO_DESTROY customKey = ffStrbufCreateNS(index, customValueStr.chars);
FFCustomValue* customValue = NULL;
FF_LIST_FOR_EACH(FFCustomValue, x, data->customValues)
{
if(ffStrbufEqual(&x->key, &customKey))
{
ffStrbufDestroy(&x->key);
ffStrbufDestroy(&x->value);
customValue = x;
break;
}
}
if(!customValue) customValue = (FFCustomValue*) ffListAdd(&data->customValues);
ffStrbufInitMove(&customValue->key, &customKey);
ffStrbufSubstrAfter(&customValueStr, index);
ffStrbufInitMove(&customValue->value, &customValueStr);
customValue->printKey = *subkey == '\0';
}