noux: respond to terminal-close event

This commit is contained in:
Norman Feske 2018-05-15 12:16:01 +02:00 committed by Christian Helmuth
parent 78c09c27ca
commit 44a6e51114

View File

@ -35,6 +35,8 @@ struct Noux::Terminal_io_channel : Io_channel
Signal_handler<Terminal_io_channel> _resize_handler; Signal_handler<Terminal_io_channel> _resize_handler;
enum { EOF = 4 };
bool eof = false; bool eof = false;
enum Type { STDIN, STDOUT, STDERR } type; enum Type { STDIN, STDOUT, STDERR } type;
@ -102,8 +104,6 @@ struct Noux::Terminal_io_channel : Io_channel
char c = read_buffer.get(); char c = read_buffer.get();
enum { EOF = 4 };
if (c == EOF) { if (c == EOF) {
/* /*
@ -225,6 +225,11 @@ struct Noux::Terminal_io_channel : Io_channel
void _handle_resize() void _handle_resize()
{ {
/* respond to terminal-close event */
Terminal::Session::Size const size = _terminal.size();
if (_terminal.size().columns()*_terminal.size().lines() == 0)
read_buffer.add(EOF);
Io_channel::invoke_all_interrupt_handlers(Sysio::SIG_WINCH); Io_channel::invoke_all_interrupt_handlers(Sysio::SIG_WINCH);
} }
}; };