mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Disable linewrap and hide cursor by default
This commit is contained in:
@@ -119,6 +119,8 @@ __fastfetch_completion()
|
||||
"--print-remaining-logo"
|
||||
"--multithreading"
|
||||
"--allow-slow-operations"
|
||||
"--disable-linewrap"
|
||||
"--hide-cursor"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_STRING=(
|
||||
|
||||
@@ -27,7 +27,6 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
|
||||
else if(formatarg->type != FF_FORMAT_ARG_TYPE_NULL)
|
||||
{
|
||||
fprintf(stderr, "Error: format string \"%s\": argument is not implemented: %i\n", buffer->chars, formatarg->type);
|
||||
exit(806);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ static void defaultConfig(FFinstance* instance)
|
||||
instance->config.cacheSave = true;
|
||||
instance->config.printRemainingLogo = true;
|
||||
instance->config.allowSlowOperations = false;
|
||||
instance->config.disableLinewrap = true;
|
||||
instance->config.hideCursor = true;
|
||||
|
||||
//This is basically the none logo
|
||||
for(uint8_t i = 0; i < sizeof(instance->config.logo.colors) / sizeof(instance->config.logo.colors[0]); ++i)
|
||||
@@ -181,6 +183,15 @@ void ffInitInstance(FFinstance* instance)
|
||||
ffCacheValidate(instance);
|
||||
}
|
||||
|
||||
void ffStart(FFinstance* instance)
|
||||
{
|
||||
if(instance->config.hideCursor)
|
||||
fputs("\033[?25l", stdout);
|
||||
|
||||
if(instance->config.disableLinewrap)
|
||||
fputs("\033[?7l", stdout);
|
||||
}
|
||||
|
||||
static void ffCleanup(FFinstance* instance)
|
||||
{
|
||||
UNUSED(instance);
|
||||
@@ -194,5 +205,11 @@ void ffFinish(FFinstance* instance)
|
||||
if(instance->config.printRemainingLogo)
|
||||
ffPrintRemainingLogo(instance);
|
||||
|
||||
if(instance->config.disableLinewrap)
|
||||
fputs("\033[?7h", stdout);
|
||||
|
||||
if(instance->config.hideCursor)
|
||||
fputs("\033[?25h", stdout);
|
||||
|
||||
ffCleanup(instance);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ static inline void printHelp()
|
||||
" --multithreading <?value>: use multiple threads to detect values\n"
|
||||
" --load-config <file>: load a config file (+)\n"
|
||||
" --allow-slow-operations <?value>: Allow operations that are usually very slow for more detailed output\n"
|
||||
" --disable-linewrap <?value>: Disable linewrap during the run\n"
|
||||
" --hide-cursor <?value>: Hide the cursor during the run\n"
|
||||
"\n"
|
||||
"Logo options:\n"
|
||||
" -l <name>, --logo <name>: sets the shown logo. Also changes the main color accordingly. This will also load file contents as logo if the given argument is a path\n"
|
||||
@@ -793,6 +795,10 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
data->multithreading = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--allow-slow-operations") == 0)
|
||||
instance->config.allowSlowOperations = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--disable-linewrap") == 0)
|
||||
instance->config.disableLinewrap = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--hide-cursor") == 0)
|
||||
instance->config.hideCursor = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--structure") == 0)
|
||||
optionParseString(key, value, &data->structure);
|
||||
else if(strcasecmp(key, "-l") == 0 || strcasecmp(key, "--logo") == 0)
|
||||
@@ -1055,6 +1061,8 @@ static void run(FFinstance* instance, FFdata* data)
|
||||
if(data->structure.length == 0)
|
||||
ffStrbufSetS(&data->structure, FASTFETCH_DEFAULT_STRUCTURE);
|
||||
|
||||
ffStart(instance);
|
||||
|
||||
uint32_t lastIndex = 0;
|
||||
while (lastIndex < data->structure.length)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,8 @@ typedef struct FFconfig
|
||||
bool cacheSave;
|
||||
bool printRemainingLogo;
|
||||
bool allowSlowOperations;
|
||||
bool disableLinewrap;
|
||||
bool hideCursor;
|
||||
|
||||
FFstrbuf osFormat;
|
||||
FFstrbuf osKey;
|
||||
@@ -241,6 +243,7 @@ typedef struct FFfont
|
||||
|
||||
//common/init.c
|
||||
void ffInitInstance(FFinstance* instance);
|
||||
void ffStart(FFinstance* instance);
|
||||
void ffFinish(FFinstance* instance);
|
||||
|
||||
//common/threading.c
|
||||
|
||||
@@ -16,6 +16,9 @@ int main(int argc, char** argv)
|
||||
//Multithreading --> better performance
|
||||
ffStartDetectionThreads(&instance);
|
||||
|
||||
//Does things like disabling line wrap
|
||||
ffStart(&instance);
|
||||
|
||||
//Printing
|
||||
ffPrintTitle(&instance);
|
||||
ffPrintSeparator(&instance);
|
||||
|
||||
Reference in New Issue
Block a user