From a2ca5df8a18714ce56c0d56fb12cbc47533311f2 Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 4 Jun 2005 14:22:59 +0000 Subject: pmore: workaround for full term-width articles. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2760 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/pmore.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 59075b1a..f9e727d0 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -67,6 +67,7 @@ #define PMORE_PRELOAD_SIZE (128*1024L) // on busy system set smaller or undef #define PMORE_TRADITIONAL_PROMPTEND // when prompt=NA, show only page 1 +#define PMORE_TRADITIONAL_FULLCOL // to work with traditional images // -------------------------------------------------------------- //#define DEBUG @@ -922,14 +923,41 @@ mf_disp() */ if(col <= maxcol) // normal case canOutput = 1; - else if (mf.dispe < mf.end-1 && // indicator space - *(mf.dispe+1) == '\n') - canOutput = 1; else if (bpref.oldwrapmode && // oldwrapmode col < t_columns) { canOutput = 1; newline = MFDISP_NEWLINE_MOVE; + } else { + int off = 0; + int inAnsi = 0; + unsigned char *p = mf.dispe +1; + // put more efforts to determine + // if we can use indicator space + // determine real offset between \n + while (p < mf.end && *p != '\n') + { + if(inAnsi) + { + if(!strchr(STR_ANSICODE, *p)) + inAnsi = 0; + } else { + if(*p == ESC_CHR) + inAnsi = 1; + else + off ++; + } + p++; + } + if (col + off <= (maxcol+1)) + canOutput = 1; // indicator space +#ifdef PMORE_TRADITIONAL_FULLCOL + else if (col + off < t_columns) + { + canOutput = 1; + newline = MFDISP_NEWLINE_MOVE; + } +#endif } if(canOutput) -- cgit v1.2.3