From 08020889d35235665d82cb01872689c5d9aed364 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Mon, 29 Jan 2001 23:37:54 +0000 Subject: [PATCH] Fix for resizing the window in modes other than normal edit mode Changes to handle_sigwinch(), main(). Fixes bug #52 (Rocco) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@509 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- BUGS | 15 +++++++-------- ChangeLog | 2 ++ nano.c | 20 ++++++++++++++++++-- proto.h | 3 ++- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/BUGS b/BUGS index 1e880890..89606d89 100644 --- a/BUGS +++ b/BUGS @@ -1,3 +1,6 @@ +- Marked cutting sometimes leaves a newline in the file unintelligently, + such as when all of a line is selected but the mark doesn't proceed to + the new line. (8) [FIXED/IRRELEVANT] - Certains are not lined up properly when there are tabs in them at certain col values. (9) [FIXED] - edit_refresh() and update_line() do not handle selecting text when the @@ -49,6 +52,7 @@ [FIXED] - Using nano -t, user can not exit until a filename is given via ^O. (30) [FIXED] +- totsize problems still abound in do_justify (33) [FIXED] - Using -k cut text is not pasted properly. (34) [FIXED]. - Using -k pasted text is not updated properly if it goes beyond editbot. (35) [FIXED] @@ -85,17 +89,12 @@ current line to the top of the screen, which it shouldn't do. (50) [FIXED] - with PDCURSES, running meta-X turns off the keypad. (51) [FIXED] +- Resizing the window completely screws up the display if in any other + mode than normal editing (help screen, search and replace, file + browser..) (52) [FIXED] - Alt speller argument (-s, --speller) does not take a string argument of more than one word. (53) [FIXED]. -- totsize problems still abound in do_justify (33) [FIXED] -- Marked cutting sometimes leaves a newline in the file unintelligently, - such as when all of a line is selected but the mark doesn't proceed to - the new line. (8) [FIXED/IRRELEVANT] ** Open BUGS ** -- Resizing the window completely screws up the display if in any other - mode than normal editing (help screen, search and replace, file - browser..) (52) - $Id$ diff --git a/ChangeLog b/ChangeLog index db9976ff..0613bc96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ General easily replaced with COLS / 2 (oops, not current_x & y (Rob)). - Deleted free_node, duplicate of delete_node, and changed all free_node calls to delete_node. + - Fix for resizing the window in modes other than normal edit mode + Changes to handle_sigwinch(), main(). Fixes bug #52 (Rocco). - files.c: write_file() - Don't free() realname on error, if it needs to be free()d later diff --git a/nano.c b/nano.c index c4544168..3d812719 100644 --- a/nano.c +++ b/nano.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,8 @@ char *last_search = NULL; /* Last string we searched for */ char *last_replace = NULL; /* Last replacement string */ int search_last_line; /* Is this the last search line? */ +static sigjmp_buf jmpbuf; /* Used to return to mainloop after SIGWINCH */ + /* What we do when we're all set to exit */ RETSIGTYPE finish(int sigage) { @@ -1610,7 +1613,12 @@ void handle_sigwinch(int s) titlebar(NULL); edit_refresh(); display_main_list(); + blank_statusbar(); total_refresh(); + + /* Jump back to mainloop */ + siglongjmp(jmpbuf, 1); + #endif } @@ -2089,8 +2097,8 @@ int main(int argc, char *argv[]) int optchr; int kbinput; /* Input from keyboard */ long startline = 0; /* Line to try and start at */ - int keyhandled = 0; /* Have we handled the keystroke yet? */ - int i, modify_control_seq = 0; + int keyhandled; /* Have we handled the keystroke yet? */ + int i, modify_control_seq; char *argv0; #ifdef _POSIX_VDISABLE struct termios term; @@ -2304,6 +2312,14 @@ int main(int argc, char *argv[]) else edit_update(fileage, CENTER); + /* return here after a sigwinch */ + sigsetjmp(jmpbuf,1); + + /* Fix clobber-age */ + kbinput = 0; + keyhandled = 0; + modify_control_seq = 0; + edit_refresh(); reset_cursor(); diff --git a/proto.h b/proto.h index 3e7a005e..9699cd07 100644 --- a/proto.h +++ b/proto.h @@ -141,7 +141,7 @@ void do_replace_highlight(int highlight_flag, char *word); void nano_disabled_msg(void); void window_init(void); #ifdef NANO_EXTRA -void do_credits(void); +void do_credits(int junk); #endif int do_writeout_void(void), do_exit(void), do_gotoline_void(void); @@ -160,6 +160,7 @@ struct stat filestat(const char *path); char *do_browse_from(char *inpath); #endif +RETSIGTYPE main_loop (int junk); filestruct *copy_node(filestruct * src); filestruct *copy_filestruct(filestruct * src); -- 2.39.5