diff options
author | Kevin McCarthy <kevin@8t8.us> | 2022-09-23 13:05:59 +0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2022-10-08 12:37:58 -0700 |
commit | 5649e381121f593b370d980f59b18427cb8acd6a (patch) | |
tree | 5ca46e2401e4b4f2c24e9669e71d20c4ad7abb4f | |
parent | fede64d0e2b7801aeeef88163bc94216963485f3 (diff) |
Set the curses resize policy to use tioctl()
mutt_resize_screen() calls mutt_reflow_windows(), which records window
sizes in those data structures. After a endwin(), curses will also
check the terminal size, but it if uses a different policy than Mutt,
the screen will be drawn incorrectly.
I looked into adding a config option to change this, but ran into a
chicken-egg problem. initscr() must be called before the config is
processed, to allow for color setting. However, use_env() must be
called before initscr(). So for now, just set to policy to ignore the
env vars, except as a fallback.
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | main.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index c12bce88..cacdf013 100644 --- a/configure.ac +++ b/configure.ac @@ -85,6 +85,8 @@ AH_TEMPLATE([HAVE_SETCCHAR], [Define if you have setcchar, as a function or macro.]) AH_TEMPLATE([HAVE_BKGRNDSET], [Define if you have bkgrndset, as a function or macro.]) +AH_TEMPLATE([HAVE_USE_TIOCTL], + [Define if you have use_tioctl, as a function or macro.]) AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T], [Some systems declare sig_atomic_t as volatile, some others -- no. This define will have value `sig_atomic_t' or @@ -360,7 +362,7 @@ main () old_LIBS="$LIBS" LIBS="$LIBS $MUTTLIBS" CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>], - [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm setcchar bkgrndset]) + [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm setcchar bkgrndset use_tioctl]) if test "$ac_cv_func_decl_start_color" = yes; then AC_DEFINE(HAVE_COLOR,1,[ Define if your curses library supports color. ]) fi @@ -598,6 +598,13 @@ static void start_curses (void) SLutf8_enable(-1); #endif #else + +# if defined(HAVE_RESIZETERM) && defined(HAVE_USE_TIOCTL) + /* mutt_resize_screen() shouldn't be fighting with ncurses */ + use_env (0); + use_tioctl (1); +# endif + /* should come before initscr() so that ncurses 4.2 doesn't try to install its own SIGWINCH handler */ mutt_signal_init (); |