mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Colors: don't print extra empty lines
This commit is contained in:
@@ -19,7 +19,7 @@ void ffPrintColors(FFColorsOptions* options)
|
||||
if(instance.config.display.pipe)
|
||||
return;
|
||||
|
||||
ffPrintLogoAndKey(FF_COLORS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
bool flag = false;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY result = ffStrbufCreateA(128);
|
||||
|
||||
@@ -34,13 +34,15 @@ void ffPrintColors(FFColorsOptions* options)
|
||||
}
|
||||
if (result.length > 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_COLORS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
flag = true;
|
||||
|
||||
if(options->paddingLeft > 0)
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
ffStrbufAppendS(&result, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
ffStrbufPutTo(&result, stdout);
|
||||
ffStrbufClear(&result);
|
||||
ffLogoPrintLine();
|
||||
}
|
||||
|
||||
// 1: Set everything to bolt. This causes normal colors on some systems to be bright.
|
||||
@@ -70,11 +72,24 @@ void ffPrintColors(FFColorsOptions* options)
|
||||
|
||||
if (result.length > 0)
|
||||
{
|
||||
if (flag)
|
||||
ffLogoPrintLine();
|
||||
else
|
||||
{
|
||||
ffPrintLogoAndKey(FF_COLORS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if(options->paddingLeft > 0)
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
ffStrbufAppendS(&result, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
ffStrbufPutTo(&result, stdout);
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
ffPrintError(FF_COLORS_MODULE_NAME, 0, &options->moduleArgs, "%s", "Nothing to print");
|
||||
}
|
||||
}
|
||||
|
||||
bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, const char* value)
|
||||
|
||||
Reference in New Issue
Block a user