1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:18:12 +00:00

TTY: Flush input on signal character.

We now flush the input when we recieve a signal character.
This can be disabled using the newly implemented NOFLSH
attribute.
This commit is contained in:
Drew Stratford 2019-11-02 03:24:14 +13:00 committed by Andreas Kling
parent 233ea7eb1d
commit b880f1928a
2 changed files with 11 additions and 0 deletions

View file

@ -109,6 +109,9 @@ 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);
@ -214,6 +217,12 @@ void TTY::generate_signal(int signal)
});
}
void TTY::flush_input()
{
m_available_lines = 0;
m_input_buffer.clear();
}
void TTY::set_termios(const termios& t)
{
m_termios = t;