From fb8a04f97aa7dbdb91470b78992097a7fad8ea6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 13 Jul 2025 20:11:12 +0800 Subject: [PATCH] Logo: don't load text files as image file Fix #1843 --- src/logo/logo.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/logo/logo.c b/src/logo/logo.c index 552c79993..b11519b0e 100644 --- a/src/logo/logo.c +++ b/src/logo/logo.c @@ -651,25 +651,28 @@ void ffLogoPrint(void) //Make sure the logo path is set correctly. updateLogoPath(); - const FFTerminalResult* terminal = ffDetectTerminal(); + if (!ffStrbufEndsWithIgnCaseS(&options->source, ".txt")) + { + const FFTerminalResult* terminal = ffDetectTerminal(); - //Terminal emulators that support kitty graphics protocol. - bool supportsKitty = - ffStrbufIgnCaseEqualS(&terminal->processName, "kitty") || - ffStrbufIgnCaseEqualS(&terminal->processName, "konsole") || - ffStrbufIgnCaseEqualS(&terminal->processName, "wezterm") || - ffStrbufIgnCaseEqualS(&terminal->processName, "wayst") || - ffStrbufIgnCaseEqualS(&terminal->processName, "ghostty") || - #ifdef __APPLE__ - ffStrbufIgnCaseEqualS(&terminal->processName, "WarpTerminal") || - #else - ffStrbufIgnCaseEqualS(&terminal->processName, "warp") || - #endif - false; + //Terminal emulators that support kitty graphics protocol. + bool supportsKitty = + ffStrbufIgnCaseEqualS(&terminal->processName, "kitty") || + ffStrbufIgnCaseEqualS(&terminal->processName, "konsole") || + ffStrbufIgnCaseEqualS(&terminal->processName, "wezterm") || + ffStrbufIgnCaseEqualS(&terminal->processName, "wayst") || + ffStrbufIgnCaseEqualS(&terminal->processName, "ghostty") || + #ifdef __APPLE__ + ffStrbufIgnCaseEqualS(&terminal->processName, "WarpTerminal") || + #else + ffStrbufIgnCaseEqualS(&terminal->processName, "warp") || + #endif + false; - //Try to load the logo as an image. If it succeeds, print it and return. - if(logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false)) - return; + //Try to load the logo as an image. If it succeeds, print it and return. + if(logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false)) + return; + } //Try to load the logo as a file. If it succeeds, print it and return. if(logoPrintFileIfExists(true, false))