From 599bb418573287e81abee33324e3e16c3d933b09 Mon Sep 17 00:00:00 2001 From: Dai Sato Date: Wed, 23 May 2007 12:26:56 +0000 Subject: [w3m-dev 03923] avoid extra blanks in pre in table. --- ChangeLog | 7 ++++++- file.c | 3 ++- table.c | 54 ++++++++++++------------------------------------------ 3 files changed, 20 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index a30767e..4cd4352 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-19 Hironori Sakamoto + + * [w3m-dev 03923]
 in 
+	* file.c, table.c: avoid extra blanks in pre in table.
+
 2007-05-23  tamo
 
 	* [20070121110209@w3mbbs] unnecessary decoding in linein.c
@@ -8821,4 +8826,4 @@ a	* [w3m-dev 03276] compile error on EWS4800
 	* release-0-2-1
 	* import w3m-0.2.1
 
-$Id: ChangeLog,v 1.980 2007/05/23 12:14:24 inu Exp $
+$Id: ChangeLog,v 1.981 2007/05/23 12:26:56 inu Exp $
diff --git a/file.c b/file.c
index 14294ab..ca920bd 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.251 2007/04/19 12:00:37 inu Exp $ */
+/* $Id: file.c,v 1.252 2007/05/23 12:26:56 inu Exp $ */
 #include "fm.h"
 #include 
 #include "myctype.h"
@@ -4606,6 +4606,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
 	    do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
 			 h_env->limit);
 	    obuf->flag |= RB_IGNORE_P;
+	    h_env->blank_lines++;
 	}
 	obuf->flag &= ~RB_PRE;
 	close_anchor(h_env, obuf);
diff --git a/table.c b/table.c
index 44991bd..c27867e 100644
--- a/table.c
+++ b/table.c
@@ -1,4 +1,4 @@
-/* $Id: table.c,v 1.53 2006/04/08 11:52:02 inu Exp $ */
+/* $Id: table.c,v 1.54 2007/05/23 12:26:56 inu Exp $ */
 /* 
  * HTML table
  */
@@ -537,48 +537,18 @@ visible_length_plain(char *str)
     return len > max_len ? len : max_len;
 }
 
-int
-maximum_visible_length(char *str)
+static int
+maximum_visible_length(char *str, int offset)
 {
-    int maxlen, len;
-
-    visible_length_offset = 0;
-    maxlen = visible_length(str);
-
-    if (!strchr(str, '\t'))
-	return maxlen;
-
-    for (visible_length_offset = 1; visible_length_offset < Tabstop;
-	 visible_length_offset++) {
-	len = visible_length(str);
-	if (maxlen < len) {
-	    maxlen = len;
-	    break;
-	}
-    }
-    return maxlen;
+    visible_length_offset = offset;
+    return visible_length(str);
 }
 
-int
-maximum_visible_length_plain(char *str)
+static int
+maximum_visible_length_plain(char *str, int offset)
 {
-    int maxlen, len;
-
-    visible_length_offset = 0;
-    maxlen = visible_length_plain(str);
-
-    if (!strchr(str, '\t'))
-	return maxlen;
-
-    for (visible_length_offset = 1; visible_length_offset < Tabstop;
-	 visible_length_offset++) {
-	len = visible_length_plain(str);
-	if (maxlen < len) {
-	    maxlen = len;
-	    break;
-	}
-    }
-    return maxlen;
+    visible_length_offset = offset;
+    return visible_length_plain(str);
 }
 
 void
@@ -3205,7 +3175,7 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode,
 	check_rowcol(tbl, mode);
 	if (mode->nobr_offset < 0)
 	    mode->nobr_offset = tbl->tabcontentssize;
-	addcontentssize(tbl, maximum_visible_length(line));
+	addcontentssize(tbl, maximum_visible_length(line, tbl->tabcontentssize));
 	setwidth(tbl, mode);
 	pushdata(tbl, tbl->row, tbl->col, line);
     }
@@ -3234,9 +3204,9 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode,
 		line = "";
 	    }
 	    if (mode->pre_mode & TBLM_PLAIN)
-		i = maximum_visible_length_plain(p);
+		i = maximum_visible_length_plain(p, tbl->tabcontentssize);
 	    else
-		i = maximum_visible_length(p);
+		i = maximum_visible_length(p, tbl->tabcontentssize);
 	    addcontentssize(tbl, i);
 	    setwidth(tbl, mode);
 	    if (nl)
-- 
cgit v1.2.3