aboutsummaryrefslogtreecommitdiffstats
path: root/anchor.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;
+ }
+ }
+}