diff --git a/src/logo/logo.c b/src/logo/logo.c index e4c36c14d..4a9d24335 100644 --- a/src/logo/logo.c +++ b/src/logo/logo.c @@ -40,7 +40,7 @@ static bool ffLogoPrintCharsRaw(const char* data, size_t length, bool printError if (!options->width) { if (printError) - fputs("Logo (iterm): Must set logo width when using position right\n", stderr); + fputs("Logo (image-raw): Must set logo width when using position right\n", stderr); return false; } ffStrbufAppendF(&buf, "\e[2J\e[3J\e[%u;9999999H\e[%uD", (unsigned) options->paddingTop + 1, (unsigned) options->paddingRight + options->width); @@ -51,7 +51,8 @@ static bool ffLogoPrintCharsRaw(const char* data, size_t length, bool printError if (options->position == FF_LOGO_POSITION_LEFT || options->position == FF_LOGO_POSITION_RIGHT) { uint16_t X = 0, Y = 0; - const char* error = ffGetTerminalResponse("\e[6n", "\e[%hu;%huR", &Y, &X); + // Windows Terminal doesn't report `\e` for some reason + const char* error = ffGetTerminalResponse("\e[6n", "%*[^0-9]%hu;%huR", &Y, &X); // %*[^0-9]: ignore optional \e[ if (error) { if (printError) @@ -59,7 +60,11 @@ static bool ffLogoPrintCharsRaw(const char* data, size_t length, bool printError return true; } if (options->position == FF_LOGO_POSITION_LEFT) + { + if (options->width + options->paddingLeft > X) + X = (uint16_t) (options->width + options->paddingLeft); instance.state.logoWidth = X + instance.config.logo.paddingRight - 1; + } instance.state.logoHeight = Y; fputs("\e[H", stdout); }