commit a8f88632faa19b0f2d3cfa5d9e9bed88156d6dda
parent a2e003f6c2c0328c0f4f67741b5fccc9180a5bb6
Author: inu <inu>
Date: Wed, 23 May 2007 12:26:56 +0000
[w3m-dev 03923] avoid extra blanks in pre in table.
Diffstat:
3 files changed, 17 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-19 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03923] <pre> in <table>
+ * file.c, table.c: avoid extra blanks in pre in table.
+
2007-05-23 tamo
* [20070121110209@w3mbbs] unnecessary decoding in linein.c
diff --git a/file.c b/file.c
@@ -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
@@ -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)