summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-09-23 13:05:59 +0800
committerKevin McCarthy <kevin@8t8.us>2022-10-08 12:37:58 -0700
commit5649e381121f593b370d980f59b18427cb8acd6a (patch)
tree5ca46e2401e4b4f2c24e9669e71d20c4ad7abb4f
parentfede64d0e2b7801aeeef88163bc94216963485f3 (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.ac4
-rw-r--r--main.c7
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
diff --git a/main.c b/main.c
index c497eadb..3b0a38ef 100644
--- a/main.c
+++ b/main.c
@@ -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 ();