X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3395ff90fe5c311285e15357d06fb08938b9b849..a37e496eeca84e0ea3fc1c7a95b013541a443cee:/uip/scansbr.c diff --git a/uip/scansbr.c b/uip/scansbr.c index df9ef645..457379cd 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -11,6 +11,7 @@ #include #include #include +#include "sbr/terminal.h" static struct format *fmt; static struct comp *datecomp; /* pntr to "date" comp */ @@ -48,6 +49,8 @@ int scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, int unseen, char *folder, long size, int noisy, charstring_t *scanl) { + static bool deja_vu; + static int tty_width; int i, compnum, encrypted, state; char *cp, *tmpbuf, *startbody, **nxtbuf; char *saved_c_text = NULL; @@ -64,9 +67,12 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, scanl used to be a global. */ if (! *scanl) { if (width == -1) { - /* Default: width of the terminal, but at least WIDTH/2. */ - if ((width = sc_width ()) < WIDTH/2) - width = WIDTH/2; + if (!deja_vu) { + deja_vu = true; + tty_width = sc_width(); + } + + width = max(tty_width, WIDTH / 2); } else if (width == 0) { /* Unlimited width. */ width = INT_MAX;