Skip to content

Commit

Permalink
chafa: Proper workaround for ghostty emoji on echo off
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
hpjansson committed Jan 8, 2025
1 parent 965f248 commit 59409a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/chafa/chafa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 59409a9

Please sign in to comment.