reset SIGWINCH when spawning a child program for displaying text items - sacc -… | |
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit 0573022ce4ceab92394c35c5701abe061f2ec35a | |
parent eae2a995544b2b48c3a7debcb186a00aa0c400b3 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Wed, 26 May 2021 16:18:22 +0200 | |
reset SIGWINCH when spawning a child program for displaying text items | |
When opening a text item in the pager such as less and then resizing the | |
terminal it would garble/overwrite the terminal output because sacc was | |
redrawn. | |
Diffstat: | |
M sacc.c | 11 +++++++++++ | |
1 file changed, 11 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/sacc.c b/sacc.c | |
@@ -285,10 +285,17 @@ printdir(Item *item) | |
static void | |
displaytextitem(Item *item) | |
{ | |
+ struct sigaction sa; | |
FILE *pagerin; | |
int pid, wpid; | |
+ sigemptyset(&sa.sa_mask); | |
+ sa.sa_flags = SA_RESTART; | |
+ sa.sa_handler = SIG_DFL; | |
+ sigaction(SIGWINCH, &sa, NULL); | |
+ | |
uicleanup(); | |
+ | |
switch (pid = fork()) { | |
case -1: | |
diag("Couldn't fork."); | |
@@ -304,6 +311,10 @@ displaytextitem(Item *item) | |
; | |
} | |
uisetup(); | |
+ | |
+ sa.sa_handler = uisigwinch; | |
+ sigaction(SIGWINCH, &sa, NULL); | |
+ uisigwinch(SIGWINCH); /* force redraw */ | |
} | |
static char * |