changeset: 6670:9937540dab42
user: Kevin McCarthy <[email protected]>
date: Tue Jun 07 13:27:45 2016 -0700
link: http://dev.mutt.org/hg/mutt/rev/9937540dab42
Fix columns used for $status_format and $pager_format in the pager.
The code was hardcoding use of MuttIndexWindow->cols in
mutt_make_string_info() and MuttStatusWindow->cols in
menu_status_line().
Add a parameter to mutt_make_info_string(). Change menu_status_line()
to use menu->statuswin->cols, falling back to MuttStatusWindow if no
menu is passed in.
Set menu->statuswin appropriately inside pager.c.
Thanks to Richard Russon for tracking down this problem, and for the initial
patch.
diffs (69 lines):
diff -r 5270cd795043 -r 9937540dab42 commands.c
--- a/commands.c Sun Jun 05 18:30:37 2016 -0700
+++ b/commands.c Tue Jun 07 13:27:45 2016 -0700
@@ -140,7 +140,7 @@
hfi.ctx = Context;
hfi.pager_progress = ExtPagerProgress;
hfi.hdr = cur;
- mutt_make_string_info (buf, sizeof (buf), NONULL(PagerFmt), &hfi,
MUTT_FORMAT_MAKEPRINT);
+ mutt_make_string_info (buf, sizeof (buf), MuttIndexWindow->cols,
NONULL(PagerFmt), &hfi, MUTT_FORMAT_MAKEPRINT);
fputs (buf, fpout);
fputs ("\n\n", fpout);
}
diff -r 5270cd795043 -r 9937540dab42 hdrline.c
--- a/hdrline.c Sun Jun 05 18:30:37 2016 -0700
+++ b/hdrline.c Tue Jun 07 13:27:45 2016 -0700
@@ -758,7 +758,7 @@
}
void
-mutt_make_string_info (char *dst, size_t dstlen, const char *s, struct
hdr_format_info *hfi, format_flag flags)
+mutt_make_string_info (char *dst, size_t dstlen, int cols, const char *s,
struct hdr_format_info *hfi, format_flag flags)
{
- mutt_FormatString (dst, dstlen, 0, MuttIndexWindow->cols, s, hdr_format_str,
(unsigned long) hfi, flags);
+ mutt_FormatString (dst, dstlen, 0, cols, s, hdr_format_str, (unsigned long)
hfi, flags);
}
diff -r 5270cd795043 -r 9937540dab42 pager.c
--- a/pager.c Sun Jun 05 18:30:37 2016 -0700
+++ b/pager.c Tue Jun 07 13:27:45 2016 -0700
@@ -1747,6 +1747,7 @@
index->max = Context->vcount;
index->current = extra->hdr->virtual;
index->indexwin = index_window;
+ index->statuswin = index_status_window;
}
NORMAL_COLOR;
@@ -1854,7 +1855,7 @@
size_t l1 = pager_status_window->cols * MB_LEN_MAX;
size_t l2 = sizeof (buffer);
hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
- mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
&hfi, MUTT_FORMAT_MAKEPRINT);
+ mutt_make_string_info (buffer, l1 < l2 ? l1 : l2,
pager_status_window->cols, NONULL (PagerFmt), &hfi, MUTT_FORMAT_MAKEPRINT);
mutt_paddstr (pager_status_window->cols, buffer);
}
else
diff -r 5270cd795043 -r 9937540dab42 protos.h
--- a/protos.h Sun Jun 05 18:30:37 2016 -0700
+++ b/protos.h Tue Jun 07 13:27:45 2016 -0700
@@ -36,7 +36,7 @@
const char *pager_progress;
};
-void mutt_make_string_info (char *, size_t, const char *, struct
hdr_format_info *, format_flag);
+void mutt_make_string_info (char *, size_t, int, const char *, struct
hdr_format_info *, format_flag);
int mutt_extract_token (BUFFER *, BUFFER *, int);
BUFFER *mutt_buffer_new (void);
diff -r 5270cd795043 -r 9937540dab42 status.c
--- a/status.c Sun Jun 05 18:30:37 2016 -0700
+++ b/status.c Tue Jun 07 13:27:45 2016 -0700
@@ -304,5 +304,7 @@
void menu_status_line (char *buf, size_t buflen, MUTTMENU *menu, const char *p)
{
- mutt_FormatString (buf, buflen, 0, MuttStatusWindow->cols, p,
status_format_str, (unsigned long) menu, 0);
+ mutt_FormatString (buf, buflen, 0,
+ menu ? menu->statuswin->cols : MuttStatusWindow->cols,
+ p, status_format_str, (unsigned long) menu, 0);
}