mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05: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:
parent
233ea7eb1d
commit
b880f1928a
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
|
||||
void set_termios(const termios&);
|
||||
bool should_generate_signals() const { return m_termios.c_lflag & ISIG; }
|
||||
bool should_flush_on_signal() const { return !(m_termios.c_lflag & NOFLSH); }
|
||||
bool should_echo_input() const { return m_termios.c_lflag & ECHO; }
|
||||
bool in_canonical_mode() const { return m_termios.c_lflag & ICANON; }
|
||||
|
||||
|
@ -46,6 +47,7 @@ protected:
|
|||
void do_backspace();
|
||||
void erase_word();
|
||||
void kill_line();
|
||||
void flush_input();
|
||||
|
||||
bool is_eol(u8) const;
|
||||
bool is_eof(u8) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue