mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 01:56:28 +01:00
prettier cursor output
This commit is contained in:
@@ -569,6 +569,40 @@ bool ffStrbufEndsWithS(const FFstrbuf* strbuf, const char* end)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool testEndsWithIgnCaseS(const FFstrbuf* strbuf, const char* end, uint32_t* endLength)
|
||||
{
|
||||
*endLength = strlen(end);
|
||||
|
||||
if(*endLength > strbuf->length)
|
||||
return false;
|
||||
|
||||
for(uint32_t i = 0; i < *endLength; ++i)
|
||||
{
|
||||
if(tolower(strbuf->chars[strbuf->length - *endLength + i]) != tolower(end[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ffStrbufEndsWithIgnCaseS(const FFstrbuf* strbuf, const char* end)
|
||||
{
|
||||
uint32_t dummy;
|
||||
return testEndsWithIgnCaseS(strbuf, end, &dummy);
|
||||
}
|
||||
|
||||
bool ffStrbufRemoveIgnCaseEndS(FFstrbuf* strbuf, const char* end)
|
||||
{
|
||||
uint32_t endLength;
|
||||
if(testEndsWithIgnCaseS(strbuf, end, &endLength))
|
||||
{
|
||||
ffStrbufSubstrBefore(strbuf, strbuf->length - endLength);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ffStrbufRecalculateLength(FFstrbuf* strbuf)
|
||||
{
|
||||
for(strbuf->length = 0; strbuf->chars[strbuf->length] != '\0'; ++strbuf->length);
|
||||
|
||||
@@ -96,6 +96,10 @@ bool ffStrbufStartsWithIgnCaseNS(const FFstrbuf* strbuf, uint32_t length, const
|
||||
|
||||
bool ffStrbufEndsWithS(const FFstrbuf* strbuf, const char* end);
|
||||
|
||||
bool ffStrbufEndsWithIgnCaseS(const FFstrbuf* strbuf, const char* end);
|
||||
|
||||
bool ffStrbufRemoveIgnCaseEndS(FFstrbuf* strbuf, const char* end);
|
||||
|
||||
void ffStrbufRecalculateLength(FFstrbuf* strbuf);
|
||||
|
||||
void ffStrbufDestroy(FFstrbuf* strbuf);
|
||||
|
||||
Reference in New Issue
Block a user