Add initial and incomplete support for SIG{CONT,TSTP} This is probably still not completely correct, e.g. can we gracefully handle the case where `/' is pressed and some input for the search was entered? diff --git a/common.h b/common.h index 675260c..b4e06c2 100644 --- a/common.h +++ b/common.h @@ -35,4 +35,6 @@ char *uiprompt(char *fmt, ...); Item *uiselectitem(Item *entry); void uisetup(void); void uisigwinch(int signal); +void uisigcont(int signal); +void uisigtstp(int signal); void uistatus(char *fmt, ...); diff --git a/sacc.c b/sacc.c index 1ed1d1c..60e62ca 100644 --- a/sacc.c +++ b/sacc.c @@ -965,6 +965,10 @@ setup(void) uisetup(); sa.sa_handler = uisigwinch; sigaction(SIGWINCH, &sa, NULL); + sa.sa_handler = uisigcont; + sigaction(SIGCONT, &sa, NULL); + sa.sa_handler = uisigtstp; + sigaction(SIGTSTP, &sa, NULL); } } diff --git a/ui_ti.c b/ui_ti.c index ae11338..c324043 100644 --- a/ui_ti.c +++ b/ui_ti.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -554,8 +555,7 @@ uisigwinch(int signal) { Dir *dir; - setupterm(NULL, 1, NULL); - putp(tparm(change_scroll_region, 0, lines-2, 0, 0, 0, 0, 0, 0, 0)); + uisetup(); if (!curentry || !(dir = curentry->dat)) return; @@ -565,3 +565,19 @@ uisigwinch(int signal) uidisplay(curentry); } + +void +uisigcont(int signal) +{ + + uicleanup(); + uisigwinch(signal); +} + +void +uisigtstp(int signal) +{ + + uicleanup(); + kill(getpid(), SIGSTOP); +} diff --git a/ui_txt.c b/ui_txt.c index 3b9d964..d7d868f 100644 --- a/ui_txt.c +++ b/ui_txt.c @@ -1,10 +1,12 @@ #include #include +#include #include #include #include #include #include +#include #include #include @@ -336,3 +338,17 @@ uisigwinch(int signal) printstatus(curentry, cmd); fflush(stdout); } + +void +uisigcont(int signal) +{ + + uisigwinch(signal); +} + +void +uisigtstp(int signal) +{ + + kill(getpid(), SIGSTOP); +}