diff -urN w3m-0.1.10/file.c w3m-0.1.10-fix/file.c --- w3m-0.1.10/file.c Tue Jun 6 14:54:35 2000 +++ w3m-0.1.10-fix/file.c Sun Jun 11 06:41:05 2000 @@ -2135,7 +2135,7 @@ if (cur_status != R_ST_NORMAL || prev_status != R_ST_NORMAL) continue; - if (!Strncasecmp_charp(tmp, "ptr, "")) { + else if (TAG_IS(tmp->ptr, "ptr[0] == '<' && Strlastchar(tmp) == '>') { @@ -2509,6 +2509,16 @@ Str id = NULL; #endif /* ID_EXT */ + if (obuf->flag & RB_PRE) { + switch (cmd) { + case HTML_NOBR: + case HTML_N_NOBR: + case HTML_PRE_INT: + case HTML_N_PRE_INT: + return 1; + } + } + switch (cmd) { case HTML_B: obuf->in_bold++; @@ -2591,6 +2601,11 @@ case HTML_OL: case HTML_BLQ: CLOSE_P; + if (!(obuf->flag & RB_IGNORE_P)) { + flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); + if (!(obuf->flag & RB_PREMODE) && h_env->envc == 0) + do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); + } PUSH_ENV(cmd); #ifndef ID_EXT targ = parse_tag(h_env->tagbuf->ptr); @@ -2610,12 +2625,7 @@ } if (cmd == HTML_UL) envs[h_env->envc].type = ul_type(targ, 0); - if (!(obuf->flag & RB_IGNORE_P)) { - flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); - if (!(obuf->flag & RB_PREMODE) && h_env->envc == 1) - do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); - } - else if (cmd == HTML_BLQ) + if (cmd == HTML_BLQ) flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); return 1; case HTML_N_UL: @@ -3134,7 +3144,6 @@ table_mode[obuf->table_level].pre_mode = 0; table_mode[obuf->table_level].indent_level = 0; table_mode[obuf->table_level].nobr_level = 0; - table_mode[obuf->table_level].mode_level = 0; table_mode[obuf->table_level].caption = 0; tables[obuf->table_level]->total_width = table_width[obuf->table_level]; if (table_width[obuf->table_level] == 0) { @@ -3967,7 +3976,7 @@ #ifdef MENU_SELECT | RB_INSELECT #endif - | RB_XMPMODE | RB_LSTMODE | RB_IGNORE)) { + | RB_IGNORE)) { Str tok = Strnew(), tmp; if (obuf->status != R_ST_NORMAL && h_env->tagbuf->length > 0) { tmp = Strdup(h_env->tagbuf); @@ -3977,7 +3986,7 @@ } while (str_bak = str, read_token(tok, &str, &obuf->status, - (obuf->flag & (RB_INTXTA | RB_XMPMODE | RB_LSTMODE)) ? 1 : 0, 0)) { + (obuf->flag & RB_INTXTA) ? 1 : 0, 0)) { char *p = tok->ptr; int status, cmd = -1; if (ST_IS_COMMENT(obuf->status)) @@ -4010,16 +4019,6 @@ feed_select(tok->ptr); } #endif - /* .. : Don't process tag */ - /* .. : ignore tag */ - else if (obuf->flag & (RB_XMPMODE | RB_LSTMODE)) { - if (((obuf->flag & RB_XMPMODE) && cmd == HTML_N_XMP) || - ((obuf->flag & RB_LSTMODE) && cmd == HTML_N_LISTING)) { - str = str_bak; - break; - } - goto read_as_plain; - } /* script */ else if (obuf->flag & RB_IGNORE) { if (TAG_IS(tok->ptr, obuf->ignore_tag->ptr, @@ -4103,19 +4102,8 @@ */ if (ST_IS_TAG(obuf->status)) { /*** continuation of a tag ***/ - read_token(h_env->tagbuf, &str, &obuf->status, 0, 1); - if (obuf->status != R_ST_NORMAL) { - if (*str == '\0') { - if (str[-1] != '\n') - Strcat_char(h_env->tagbuf, '\n'); - return; - } - if (obuf->status == R_ST_DQUOTE) { - if (Strlastchar(h_env->tagbuf) == '\n') { - Strchop(h_env->tagbuf); - } - } - } + read_token(h_env->tagbuf, &str, &obuf->status, + obuf->flag & (RB_XMPMODE | RB_LSTMODE), 1); } else { if (!REALLY_THE_BEGINNING_OF_A_TAG(str)) { @@ -4125,33 +4113,40 @@ str++; continue; } - read_token(h_env->tagbuf, &str, &obuf->status, 0, 0); - if (ST_IS_COMMENT(obuf->status)) { - if (obuf->flag & RB_IGNORE) - /* within ignored tag, such as * - * , don't process comment. */ - obuf->status = R_ST_NORMAL; - return; - } - if (h_env->tagbuf->length == 0) - continue; + read_token(h_env->tagbuf, &str, &obuf->status, + obuf->flag & (RB_XMPMODE | RB_LSTMODE), 0); + } + if (ST_IS_COMMENT(obuf->status)) { + if (obuf->flag & RB_IGNORE) + /* within ignored tag, such as * + * , don't process comment. */ + obuf->status = R_ST_NORMAL; + return; + } + if (h_env->tagbuf->length == 0) + continue; /*** Beginning of a new tag ***/ - if (obuf->flag & RB_PLAIN) - goto read_as_plain; /* don't process tag */ - if (obuf->status != R_ST_NORMAL) { - if (obuf->status == R_ST_DQUOTE) { - if (Strlastchar(h_env->tagbuf) == '\n') { - Strchop(h_env->tagbuf); - } - } - /* contine to the next line */ - if (str[-1] != '\n') + if (obuf->flag & RB_PLAIN) + goto read_as_plain; /* don't process tag */ + if (*str == '\0' && obuf->status != R_ST_NORMAL) { + if (!(obuf->flag & (RB_XMPMODE | RB_LSTMODE))) { + if (obuf->status == R_ST_DQUOTE && + Strlastchar(h_env->tagbuf) == '\n') + Strchop(h_env->tagbuf); + else if (str[-1] != '\n') Strcat_char(h_env->tagbuf, '\n'); - return; } + return; } q = h_env->tagbuf->ptr; cmd = gethtmlcmd(&q, &status); + if (obuf->flag & RB_XMPMODE && cmd != HTML_N_XMP || + obuf->flag & RB_LSTMODE && cmd != HTML_N_LISTING) { + Str tmp = Strdup(h_env->tagbuf); + Strcat_charp(tmp, str); + str = tmp->ptr; + goto read_as_plain; + } #ifdef ID_EXT targ = parse_tag(h_env->tagbuf->ptr); /* process tags */ @@ -4205,7 +4200,7 @@ } while (obuf->pos % Tabstop != 0); str++; } - else if (obuf->flag & RB_XMPMODE) { + else if (obuf->flag & (RB_XMPMODE | RB_LSTMODE)) { char *p = htmlquote_char(*str); if (p) { while (*p) { @@ -4671,8 +4666,11 @@ HTMLlineproc1("", &htmlenv1); #endif /* for unbalanced table tag */ - while (obuf.table_level > 0) + while (obuf.table_level > 0) { + table_mode[obuf.table_level -1].pre_mode + &= ~(TBLM_IGNORE | TBLM_XMP | TBLM_LST); HTMLlineproc1("", &htmlenv1); + } flushline(&htmlenv1, &obuf, 0, 0, htmlenv1.limit); if (htmlenv1.title) diff -urN w3m-0.1.10/main.c w3m-0.1.10-fix/main.c --- w3m-0.1.10/main.c Tue Jun 6 14:56:48 2000 +++ w3m-0.1.10-fix/main.c Sat Jun 10 13:21:42 2000 @@ -1556,7 +1556,7 @@ } else gotoRealLine(Currentbuf, atoi(l)); - arrangeLine(Currentbuf); + arrangeCursor(Currentbuf); displayBuffer(Currentbuf, B_FORCE_REDRAW); } diff -urN w3m-0.1.10/table.c w3m-0.1.10-fix/table.c --- w3m-0.1.10/table.c Tue Jun 6 14:39:13 2000 +++ w3m-0.1.10-fix/table.c Sun Jun 11 06:29:44 2000 @@ -779,7 +779,13 @@ else HTMLlineproc1(l->ptr, &h_env); } +#if 1 flushline(&h_env, &obuf, 0, 0, h_env.limit); +#else + flushline(&h_env, &obuf, 0, 0, h_env.limit); + if (tbl->border_mode == BORDER_NONE && row < tbl->maxrow) + do_blankline(&h_env, &obuf, 0, 0, h_env.limit); +#endif } static void @@ -1437,8 +1443,10 @@ if (tl->nitem > 0) { TextListItem *ti; tmp = Strnew_charp("
");
-	for (ti = tl->first; ti != NULL; ti = ti->next)
+	for (ti = tl->first; ti != NULL; ti = ti->next) {
 	    Strcat_charp(tmp, ti->ptr);
+	    Strcat_char(tmp, '\n');
+	}
 	Strcat_charp(tmp, "
"); HTMLlineproc1(tmp->ptr, h_env); } @@ -1654,11 +1662,14 @@ } maxheight += t->tabheight[r]; } - if (t->border_mode == BORDER_THIN || t->border_mode == BORDER_THICK) { + switch (t->border_mode) { + case BORDER_THIN: + case BORDER_THICK: renderbuf = Strnew(); print_sep(t, t->maxrow, T_BOTTOM, t->maxcol, renderbuf); HTMLlineproc1(renderbuf->ptr, h_env); maxheight += 1; + break; } if (maxheight == 0) HTMLlineproc1(" ", h_env); @@ -1944,6 +1955,7 @@ * . */ if (mode->pre_mode & TBLM_INSELECT) { switch (cmd) { + case HTML_N_FORM: case HTML_TABLE: case HTML_N_TABLE: case HTML_TR: @@ -1968,6 +1980,25 @@ } #endif /* MENU_SELECT */ + if ( +#ifdef MENU_SELECT + mode->pre_mode & TBLM_INSELECT && cmd != HTML_N_SELECT || +#endif /* MENU_SELECT */ + mode->pre_mode & TBLM_INTXTA && cmd != HTML_N_TEXTAREA || + mode->pre_mode & TBLM_XMP && cmd != HTML_N_XMP || + mode->pre_mode & TBLM_LST && cmd != HTML_N_LISTING) + return TAG_ACTION_FEED; + + if (mode->pre_mode & TBLM_PRE) { + switch (cmd) { + case HTML_NOBR: + case HTML_N_NOBR: + case HTML_PRE_INT: + case HTML_N_PRE_INT: + return TAG_ACTION_NONE; + } + } + switch (cmd) { case HTML_TABLE: return TAG_ACTION_TABLE; @@ -1980,7 +2011,6 @@ mode->caption = 0; mode->indent_level = 0; mode->nobr_level = 0; - mode->mode_level = 0; mode->pre_mode = 0; tbl->col = -1; tbl->row++; @@ -2014,7 +2044,6 @@ mode->caption = 0; mode->indent_level = 0; mode->nobr_level = 0; - mode->mode_level = 0; mode->pre_mode = 0; tbl->flag |= TBL_IN_COL; tbl->linfo.prev_spaces = -1; @@ -2257,8 +2286,12 @@ check_rowcol(tbl); clearcontentssize(tbl, mode); pushdata(tbl, tbl->row, tbl->col, line); - mode->pre_mode |= TBLM_PRE; - mode->mode_level++; + if (cmd == HTML_PRE) + mode->pre_mode |= TBLM_PRE; + else if (cmd == HTML_LISTING) + mode->pre_mode |= TBLM_LST; + else if (cmd == HTML_XMP) + mode->pre_mode |= TBLM_XMP; break; case HTML_N_PRE: case HTML_N_LISTING: @@ -2267,10 +2300,12 @@ check_rowcol(tbl); clearcontentssize(tbl, mode); pushdata(tbl, tbl->row, tbl->col, line); - if (mode->mode_level > 0) - mode->mode_level--; - if (mode->mode_level == 0) + if (cmd == HTML_N_PRE) mode->pre_mode &= ~TBLM_PRE; + else if (cmd == HTML_N_LISTING) + mode->pre_mode &= ~TBLM_LST; + else if (cmd == HTML_N_XMP) + mode->pre_mode &= ~TBLM_XMP; tbl->linfo.prev_spaces = 0; tbl->linfo.prevchar = '\0'; tbl->linfo.prev_ctype = PC_ASCII; @@ -2546,7 +2581,8 @@ } #endif /* MENU_SELECT */ /* convert &...; if it is latin-1 character */ - if (!(*line == '<' && line[strlen(line) - 1] == '>') && + if (!(mode->pre_mode & (TBLM_XMP|TBLM_LST)) && + !(*line == '<' && line[strlen(line) - 1] == '>') && strchr(line, '&') != NULL) { tmp = Strnew(); for (p = line; *p;) { @@ -2579,7 +2615,7 @@ } line = tmp->ptr; } - if (!(mode->pre_mode & (TBLM_PRE | TBLM_PRE_INT))) { + if (!(mode->pre_mode & TBLM_SPECIAL)) { if (!(tbl->flag & TBL_IN_COL)) { linfo->prev_spaces = -1; linfo->prev_ctype = PC_ASCII; @@ -2603,7 +2639,10 @@ check_rowcol(tbl); if (mode->pre_mode & TBLM_PRE_INT && mode->nobr_offset < 0) mode->nobr_offset = tbl->tabcontentssize; - i = maximum_visible_length(line); + if (mode->pre_mode & (TBLM_XMP|TBLM_LST)) + i = strlen(line); + else + i = maximum_visible_length(line); addcontentssize(tbl, i); setwidth(tbl, mode); if (!(mode->pre_mode & TBLM_PRE_INT)) { diff -urN w3m-0.1.10/table.h w3m-0.1.10-fix/table.h --- w3m-0.1.10/table.h Tue Jun 6 14:39:13 2000 +++ w3m-0.1.10-fix/table.h Sat Jun 10 03:14:13 2000 @@ -119,10 +119,13 @@ #define TBLM_PRE 1 #define TBLM_NOBR 2 +#define TBLM_XMP 4 +#define TBLM_LST 8 #define TBLM_PRE_INT 32 #define TBLM_INTXTA 64 #define TBLM_INSELECT 128 -#define TBLM_PREMODE (TBLM_PRE|TBLM_INTXTA|TBLM_INSELECT) +#define TBLM_PREMODE (TBLM_PRE|TBLM_INTXTA|TBLM_INSELECT|TBLM_XMP|TBLM_LST) +#define TBLM_SPECIAL (TBLM_PRE|TBLM_PRE_INT|TBLM_XMP|TBLM_LST) #define TBLM_SCRIPT 256 #define TBLM_STYLE 512 #define TBLM_IGNORE (TBLM_SCRIPT|TBLM_STYLE) @@ -135,5 +138,4 @@ char caption; short nobr_offset; char nobr_level; - char mode_level; };