summaryrefslogtreecommitdiffstats
path: root/mbbsd/pmore.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-04 22:22:59 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-04 22:22:59 +0800
commita2ca5df8a18714ce56c0d56fb12cbc47533311f2 (patch)
treeac88084d62d07249b913a8d38db9685741fee446 /mbbsd/pmore.c
parent1b0dbadf7d9151cc57fe7ffc10fcf749a375ed6c (diff)
downloadpttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar.gz
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar.bz2
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar.lz
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar.xz
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.tar.zst
pttbbs-a2ca5df8a18714ce56c0d56fb12cbc47533311f2.zip
pmore: workaround for full term-width articles.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2760 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/pmore.c')
-rw-r--r--mbbsd/pmore.c34
1 files 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
// -------------------------------------------------------------- </FEATURES>
//#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)