summaryrefslogtreecommitdiffstats
path: root/curs_lib.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-04-23 18:35:30 -0700
committerKevin McCarthy <kevin@8t8.us>2021-04-23 18:35:30 -0700
commit30e657d30be7e20c912bdebe9f0c7aa1eddd57ad (patch)
tree911fdf0606bfe3196de4d9f4bb2136d8eba14763 /curs_lib.c
parentfe866a19a11112696aea1ee7016d477ee9d5d00d (diff)
Improve sidebar drawing in small windows.
Ensure the index window is given at least one column during reflow, truncating the sidebar width as necessary. Change the sidebar to use MuttSidebarWindow->cols instead of directly referencing SidebarWidth.
Diffstat (limited to 'curs_lib.c')
-rw-r--r--curs_lib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/curs_lib.c b/curs_lib.c
index 18f75e3d..7a5a3f54 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -784,10 +784,14 @@ void mutt_reflow_windows (void)
if (option (OPTSIDEBAR))
{
memcpy (MuttSidebarWindow, MuttIndexWindow, sizeof (mutt_window_t));
- MuttSidebarWindow->cols = SidebarWidth;
-
- MuttIndexWindow->cols -= SidebarWidth;
- MuttIndexWindow->col_offset += SidebarWidth;
+ MuttSidebarWindow->cols = MAX (SidebarWidth, 0);
+ /* Ensure the index window has at least one column, to prevent
+ * pager regressions. */
+ if (MuttSidebarWindow->cols >= MuttIndexWindow->cols)
+ MuttSidebarWindow->cols = MuttIndexWindow->cols - 1;
+
+ MuttIndexWindow->cols -= MuttSidebarWindow->cols;
+ MuttIndexWindow->col_offset += MuttSidebarWindow->cols;
}
#endif