nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 32431cddf84443d0245b8b8adc2de812bc05a2e2
parent 8e302738e86b4c039a1861b65cf0a30902c80c64
Author: Brand Huntsman <alpha@qzx.com>
Date:   Sun, 31 Mar 2019 17:17:45 -0600

files: block the resizing signal while reading from an external command

A SIGWINCH somehow causes the input stream to see EOT, with the result
that any remaining output of an external program would be lost.

This fixes https://savannah.gnu.org/bugs/?56038,
and fixes https://savannah.gnu.org/bugs/?56033.

Signed-off-by: Brand Huntsman <alpha@qzx.com>

Diffstat:
Msrc/files.c | 8++++++++
Msrc/nano.c | 7++++++-
Msrc/proto.h | 2+-
3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -800,6 +800,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable) topline = make_new_node(NULL); bottomline = topline; +#ifndef NANO_TINY + block_sigwinch(TRUE); +#endif + /* Lock the file before starting to read it, to avoid the overhead * of locking it for each single byte that we read from it. */ flockfile(f); @@ -875,6 +879,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable) /* We are done with the file, unlock it. */ funlockfile(f); +#ifndef NANO_TINY + block_sigwinch(FALSE); +#endif + /* Perhaps this could use some better handling. */ if (ferror(f)) nperror(filename); diff --git a/src/nano.c b/src/nano.c @@ -1290,7 +1290,7 @@ RETSIGTYPE do_continue(int signal) ungetch(KEY_FLUSH); } -#ifdef ENABLE_SPELLER +#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) /* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */ void block_sigwinch(bool blockit) { @@ -1299,6 +1299,11 @@ void block_sigwinch(bool blockit) sigemptyset(&winch); sigaddset(&winch, SIGWINCH); sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL); + +#ifndef NANO_TINY + if (the_window_resized) + regenerate_screen(); +#endif } #endif diff --git a/src/proto.h b/src/proto.h @@ -424,7 +424,7 @@ RETSIGTYPE handle_crash(int signal); #endif RETSIGTYPE do_suspend(int signal); RETSIGTYPE do_continue(int signal); -#ifdef ENABLE_SPELLER +#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) void block_sigwinch(bool blockit); #endif #ifndef NANO_TINY