TTY: Don't flush input on every character

Oops, we had a little mistake here. We were flushing whenever !NOFLSH,
not just when generating a signal.

This broke arrow keys in the terminal (you would only get A/B/C/D when
pressing arrow keys, instead of the full escape sequence.)
This commit is contained in:
Andreas Kling 2019-11-02 10:07:14 +01:00
parent f9d679ae37
commit 05252cfd3a
Notes: sideshowbarker 2024-07-19 11:28:48 +09:00

View file

@ -109,9 +109,6 @@ bool TTY::is_werase(u8 ch) const
void TTY::emit(u8 ch)
{
if (should_generate_signals()) {
if (should_flush_on_signal())
flush_input();
if (ch == m_termios.c_cc[VINTR]) {
dbg() << tty_name() << ": VINTR pressed!";
generate_signal(SIGINT);
@ -208,6 +205,8 @@ void TTY::generate_signal(int signal)
{
if (!pgid())
return;
if (should_flush_on_signal())
flush_input();
dbg() << tty_name() << ": Send signal " << signal << " to everyone in pgrp " << pgid();
InterruptDisabler disabler; // FIXME: Iterate over a set of process handles instead?
Process::for_each_in_pgrp(pgid(), [&](auto& process) {