Separator: honors FQDN settings in Title module

This commit is contained in:
李通洲
2025-08-14 13:30:02 +08:00
parent e80bb480c4
commit 0fe3db419e
4 changed files with 4 additions and 3 deletions
+1 -2
View File
@@ -56,7 +56,6 @@ void ffPrintSeparator(FFSeparatorOptions* options)
{
setlocale(LC_CTYPE, "");
mbstate_t state = {};
bool fqdn = true; // TODO: Make this configurable
const FFPlatform* platform = &instance.state.platform;
FF_AUTO_FREE wchar_t* wstr = malloc((max(
@@ -64,7 +63,7 @@ void ffPrintSeparator(FFSeparatorOptions* options)
uint32_t titleLength = 1 // @
+ getWcsWidth(&platform->userName, wstr, &state) // user name
+ (fqdn ? platform->hostName.length : ffStrbufFirstIndexC(&platform->hostName, '.')); // host name
+ (instance.state.titleFqdn ? platform->hostName.length : ffStrbufFirstIndexC(&platform->hostName, '.')); // host name
if(__builtin_expect(options->string.length == 1, 1))
{
+1 -1
View File
@@ -2,7 +2,6 @@
#include "common/jsonconfig.h"
#include "modules/title/title.h"
#include "util/textModifier.h"
#include "util/stringUtils.h"
static void appendText(FFstrbuf* output, const FFstrbuf* text, const FFstrbuf* color)
{
@@ -30,6 +29,7 @@ void ffPrintTitle(FFTitleOptions* options)
FF_STRBUF_AUTO_DESTROY hostName = ffStrbufCreateCopy(&instance.state.platform.hostName);
if (!options->fqdn)
ffStrbufSubstrBeforeFirstC(&hostName, '.');
instance.state.titleFqdn = options->fqdn;
FF_STRBUF_AUTO_DESTROY hostNameColored = ffStrbufCreate();
appendText(&hostNameColored, &hostName, &options->colorHost);