Logo (Image): improves compatibility for iTerm when printing gif logo

This commit is contained in:
Carter Li
2026-09-21 14:14:09 +08:00
parent 1023388d60
commit 17b98007b4
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -87,6 +87,8 @@ Bugfixes:
* Fixed module format strings mishandling a value that carries more than one leading ANSI escape sequence: the second escape was taken for the start of the trailing reset, so `:`, `<`, `>` and `|` left the value untruncated instead of truncating it.
* Fixed issues when running on big-endian platforms.
* Fixed building on FreeBSD 16.0-CURRENT, where `<string.h>` defines `memrchr` as a qualifier-preserving function-like macro. (General, FreeBSD)
* Worked around an iTerm bug where the image logo may be moved out of view. (Logo)
* Increased the terminal response wait time to 1s to improve compatibility with slower terminals. (General)
* Some internal cleanups and optimizations.
Logos:
+1 -1
View File
@@ -228,7 +228,7 @@ typedef enum FFPathType: uint8_t {
[[gnu::nonnull(1, 2)]] bool ffPathExpandEnv(const char* in, FFstrbuf* out);
#define FF_IO_TERM_RESP_WAIT_MS 200 // #554
#define FF_IO_TERM_RESP_WAIT_MS 1000 // Terminal may respond slowly, especially when printing large image/gif logos. Found on iTerm
[[gnu::format(scanf, 3, 4), gnu::nonnull(1, 3)]] const char* ffGetTerminalResponse(const char* request, int nParams, const char* format, ...);
+3 -1
View File
@@ -84,7 +84,9 @@ static bool printImageIterm(bool printError) {
instance.state.logoWidth = X + options->paddingRight - 1;
}
instance.state.logoHeight = Y;
fputs("\e[H", stdout);
// Work around an iTerm bug. Without the leading whitespace the image logo may be moved out of view
// Found in iTerm 3.7.2
fputs(" \e[H", stdout);
} else if (options->position == FF_LOGO_POSITION_TOP) {
instance.state.logoWidth = instance.state.logoHeight = 0;
ffPrintCharTimes('\n', options->paddingRight);