do the resize signally properly

This commit is contained in:
Bill Currie 2001-09-25 20:35:37 +00:00
parent df330f33fd
commit 5195c065c6

View file

@ -69,6 +69,7 @@ static WINDOW *output;
static WINDOW *status; static WINDOW *status;
static WINDOW *input; static WINDOW *input;
static int screen_x, screen_y; static int screen_x, screen_y;
static int interrupted;
#define MAXCMDLINE 256 #define MAXCMDLINE 256
static inputline_t *input_line; static inputline_t *input_line;
@ -111,7 +112,7 @@ C_ExecLine (const char *line)
static void static void
sigwinch (int sig) sigwinch (int sig)
{ {
ungetch (KEY_RESIZE); interrupted = 1;
signal (SIGWINCH, sigwinch); signal (SIGWINCH, sigwinch);
} }
#endif #endif
@ -231,17 +232,17 @@ C_ProcessInput (void)
int ch = wgetch (input), i; int ch = wgetch (input), i;
const char *text; const char *text;
switch (ch) { if (interrupted) {
case KEY_RESIZE:
{
struct winsize size; struct winsize size;
interrupted = 0;
if (ioctl (fileno (stdout), TIOCGWINSZ, &size) == 0) { if (ioctl (fileno (stdout), TIOCGWINSZ, &size) == 0) {
resizeterm (size.ws_row, size.ws_col); resizeterm (size.ws_row, size.ws_col);
wrefresh (curscr); wrefresh (curscr);
} }
} }
break;
switch (ch) {
case KEY_ENTER: case KEY_ENTER:
case '\n': case '\n':
case '\r': case '\r':