From: Chris Allegretta Date: Fri, 25 Jun 2004 23:57:55 +0000 (+0000) Subject: DLR's resizeterm removal code, which seems to work nicely X-Git-Tag: v1.2.4~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=682a2ed6f455aa9e1519fc6d49263892246bbb9d;p=nano.git DLR's resizeterm removal code, which seems to work nicely git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_2_branch/nano@1819 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 992baf4a..0b476c01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,14 +6,27 @@ CVS code - when to not run the winch handles, static resizepending is set, handler in main to run handle_sigwinch() when set. Should fix segfaults when nano is initially suspended while - reading in a file. - *** FIXME: WHo t credit fo finding this bug? + reading in a file (found by Mike Frysinger). - nano.c: + handle_sigwinch() + - Rework so that nano properly redraws the screen on systems + that don't have resizeterm() and/or wresize(). In curses, we + now leave and immediately reenter curses mode via endwin() and + refresh(), and then reinitialize all windows via + window_init(). In slang, the above routine will only work if + the resize made the window smaller, so we now leave and + immediately reenter screen management mode via + SLsmg_reset_smg() and SLsmg_init_smg(), and then reinitialize + all windows via window_init(). (DLR, adapted from code in + Minimum Profit 3.3.0 and mutt 1.4.2.1, respectively) main() - Don't call open_file with quiet flag set. Fixes Debian bug #246956 (no warning when trying to open non-readable file). - Add an extra titlebar() call (useful when reading in a big file). +- configure.ac: + - Remove the checks for resizeterm() and wresize(), as they're + no longer needed. (DLR) - config.rpath: - Replace usage of egrep with grep -E, avoiding a XSI:ism (David Weinehall) diff --git a/configure.ac b/configure.ac index 015ed33d..990889e9 100644 --- a/configure.ac +++ b/configure.ac @@ -328,9 +328,6 @@ fi AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.])) if test x$slang_support != xyes; then - AC_CHECK_LIB([$CURSES_LIB_NAME], wresize, AC_DEFINE(HAVE_WRESIZE, 1, [Define this if you have the wresize function in your ncurses-type library.])) - AC_CHECK_LIB([$CURSES_LIB_NAME], resizeterm, AC_DEFINE(HAVE_RESIZETERM, 1, [Define this if you have the resizeterm function in your ncurses-type library.])) - # Taken from aumix (can't tell from the variable name?) AC_CACHE_CHECK([for private member _use_keypad in WINDOW], aumix_cv_struct_window_usekeypad, diff --git a/nano.c b/nano.c index b97fccad..7051938b 100644 --- a/nano.c +++ b/nano.c @@ -2890,23 +2890,24 @@ void handle_sigwinch(int s) memset(hblank, ' ', COLS); hblank[COLS] = '\0'; -#ifdef HAVE_RESIZETERM - resizeterm(LINES, COLS); -#ifdef HAVE_WRESIZE - if (wresize(topwin, 2, COLS) == ERR) - die(_("Cannot resize top win")); - if (mvwin(topwin, 0, 0) == ERR) - die(_("Cannot move top win")); - if (wresize(edit, editwinrows, COLS) == ERR) - die(_("Cannot resize edit win")); - if (mvwin(edit, 2, 0) == ERR) - die(_("Cannot move edit win")); - if (wresize(bottomwin, 3 - no_help(), COLS) == ERR) - die(_("Cannot resize bottom win")); - if (mvwin(bottomwin, LINES - 3 + no_help(), 0) == ERR) - die(_("Cannot move bottom win")); -#endif /* HAVE_WRESIZE */ -#endif /* HAVE_RESIZETERM */ +#ifdef USE_SLANG + /* Slang curses emulation brain damage: If we just do what curses + * does here, it'll only work properly if the resize made the + * window smaller. Do what mutt does: Leave and immediately reenter + * Slang screen management mode. */ + SLsmg_reset_smg(); + SLsmg_init_smg(); +#else + /* Do the equivalent of what Minimum Profit does: Leave and + * immediately reenter curses mode. */ + endwin(); + refresh(); +#endif + + /* Do the equivalent of what both mutt and Minimum Profit do: + * Reinitialize all the windows based on the new screen + * dimensions. */ + window_init(); fix_editbot();