From 59409a9f6a7b56b101ddde84d4af996389777398 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Wed, 8 Jan 2025 20:42:05 +0100 Subject: [PATCH] chafa: Proper workaround for ghostty emoji on echo off Disable canonical mode along with echo. This works around the ghostty heuristic that causes it to emit emoji when echo is turned off. The relevant snippets from ghostty, for future reference: .canonical = (attrs.c_lflag & c.ICANON) != 0, .echo = (attrs.c_lflag & c.ECHO) != 0, // We assume we're in some sort of password input if we're // in canonical mode and not echoing. This is a heuristic. const password_input = mode.canonical and !mode.echo; Thanks to @veltza and @AnonymouX47 for discovering the issue and suggesting the fix. Part of fix for #239 (GitHub). --- tools/chafa/chafa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/chafa/chafa.c b/tools/chafa/chafa.c index ab97d1c..e2a0556 100644 --- a/tools/chafa/chafa.c +++ b/tools/chafa/chafa.c @@ -1811,7 +1811,7 @@ tty_options_init (void) tcgetattr (STDIN_FILENO, &saved_termios); t = saved_termios; - t.c_lflag &= ~ECHO; + t.c_lflag &= ~(ECHO | ICANON); tcsetattr (STDIN_FILENO, TCSANOW, &t); } #endif