X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=e0aae9dd63dd959c41f92406215b9948af9d0dbb;hp=a2703f41fbac001a45fe407462071d8074bb54a2;hb=8de8ae3923b3b91b034077c8c35acba629588233;hpb=769d48180747c3255653360d161c77ec2a2e8d13 diff --git a/st.c b/st.c index a2703f4..e0aae9d 100644 --- a/st.c +++ b/st.c @@ -1176,16 +1176,15 @@ execsh(void) { void sigchld(int a) { - int stat = 0; + int stat, ret; if(waitpid(pid, &stat, 0) < 0) die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); - if(WIFEXITED(stat)) { - exit(WEXITSTATUS(stat)); - } else { - exit(EXIT_FAILURE); - } + ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; + if (ret != EXIT_SUCCESS) + die("child finished with error '%d'\n", stat); + exit(EXIT_SUCCESS); } void @@ -1554,6 +1553,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) { void tclearregion(int x1, int y1, int x2, int y2) { int x, y, temp; + Glyph *gp; if(x1 > x2) temp = x1, x1 = x2, x2 = temp; @@ -1568,10 +1568,13 @@ tclearregion(int x1, int y1, int x2, int y2) { for(y = y1; y <= y2; y++) { term.dirty[y] = 1; for(x = x1; x <= x2; x++) { + gp = &term.line[y][x]; if(selected(x, y)) selclear(NULL); - term.line[y][x] = term.c.attr; - memcpy(term.line[y][x].c, " ", 2); + gp->fg = term.c.attr.fg; + gp->bg = term.c.attr.bg; + gp->mode = 0; + memcpy(gp->c, " ", 2); } } }