aboutsummaryrefslogtreecommitdiffstats
path: root/anchor.c
diff options
context:
space:
mode:
authorAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-09 04:59:17 +0000
committerAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-09 04:59:17 +0000
commit6c63633545c254dc085402e0f927a6826d1dd229 (patch)
tree0126fb5598304c713ea1276e294da9098b5df3b4 /anchor.c
parentInitial revision (diff)
downloadw3m-6c63633545c254dc085402e0f927a6826d1dd229.tar.gz
w3m-6c63633545c254dc085402e0f927a6826d1dd229.zip
Updates from 0.2.1 into 0.2.1-inu-1.5release-0-2-1-inu-1-5
Diffstat (limited to 'anchor.c')
-rw-r--r--anchor.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/anchor.c b/anchor.c
index 6005899..855585e 100644
--- a/anchor.c
+++ b/anchor.c
@@ -1,4 +1,4 @@
-/* $Id: anchor.c,v 1.1 2001/11/08 05:14:10 a-ito Exp $ */
+/* $Id: anchor.c,v 1.2 2001/11/09 04:59:17 a-ito Exp $ */
#ifdef __EMX__
#include <strings.h>
#endif
@@ -96,7 +96,6 @@ registerForm(Buffer * buf, FormList * flist, struct parsed_tag * tag, int line,
&a,
NULL,
line, pos);
- fi->anchor_num = buf->formitem->nanchor - 1;
return a;
}
@@ -358,7 +357,7 @@ putHmarker(HmarkerList * ml, int line, int pos, int seq)
}
if (ml->markmax == 0) {
ml->markmax = FIRST_MARKER_SIZE;
- ml->marks = New_N(BufferPoint, ml->markmax);
+ ml->marks = NewAtom_N(BufferPoint, ml->markmax);
#ifdef __CYGWIN__
bzero((char *) ml->marks, sizeof(BufferPoint) * ml->markmax);
#else /* not __CYGWIN__ */
@@ -418,3 +417,59 @@ closest_prev_anchor(AnchorList * a, Anchor * an, int x, int y)
}
return an;
}
+
+void
+addMultirowsForm(Buffer *buf, AnchorList *al)
+{
+ int i, j, k, col, ecol, pos;
+ Anchor a_form, *a;
+ FormItemList *fi;
+ Line *l, *ls;
+
+ if (al == NULL || al->nanchor == 0)
+ return;
+ for (i = 0; i < al->nanchor; i++) {
+ a_form = al->anchors[i];
+ al->anchors[i].rows = 1;
+ if (a_form.hseq < 0 || a_form.rows <= 1)
+ continue;
+ for (l = buf->firstLine; l != NULL; l = l->next) {
+ if (l->linenumber == a_form.y)
+ break;
+ }
+ if (! l)
+ continue;
+ if (a_form.y == a_form.start.line)
+ ls = l;
+ else {
+ for (ls = l; ls != NULL;
+ ls = (a_form.y < a_form.start.line) ? ls->next : ls->prev) {
+ if (ls->linenumber == a_form.start.line)
+ break;
+ }
+ if (! ls)
+ continue;
+ }
+ fi = (FormItemList *) a_form.url;
+ col = COLPOS(ls, a_form.start.pos);
+ ecol = COLPOS(ls, a_form.end.pos);
+ for (j = 0; l && j < a_form.rows; l = l->next, j++) {
+ pos = columnPos(l, col);
+ if (j == 0) {
+ buf->hmarklist->marks[a_form.hseq].line = l->linenumber;
+ buf->hmarklist->marks[a_form.hseq].pos = pos;
+ }
+ if (a_form.start.line == l->linenumber)
+ continue;
+ buf->formitem = putAnchor(buf->formitem, a_form.url,
+ a_form.target, &a, NULL, l->linenumber, pos);
+ a->hseq = a_form.hseq;
+ a->y = a_form.y;
+ a->end.pos = pos + ecol - col;
+ l->lineBuf[pos - 1] = '[';
+ l->lineBuf[a->end.pos] = ']';
+ for (k = pos; k < a->end.pos; k++)
+ l->propBuf[k] |= PE_FORM;
+ }
+ }
+}