[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users 00757] Re: nesting-bug with multiple tabs in 1.09a



> Now 'test2' is shown with the same font/size as 'test B' (should be same
> as 'test').
> 
> The tab definitions in the example are from default.mgp in sample dir.

Since the <tabnum> argument of the %tab directive is the number of TABs,
the lines without leading TABs are not affected by %tab.
There was a discussion why '%tab 0' is not allowed, but no consensus
has been made, as far as I know.

Attached is a ad-hoc patch to allow '%tab 0' directive to define
directive list for the line without leading TABs.
It should affect documents with '%tab 0' directive only, but I'm not
sure if other source should be fixed.

Regards,

Atsushi Onoe

Index: parse.c
===================================================================
RCS file: /usr/cvsroot/mgp/kit/parse.c,v
retrieving revision 1.86
diff -u -r1.86 parse.c
--- parse.c	2001/09/17 14:48:30	1.86
+++ parse.c	2001/11/26 12:58:08
@@ -355,7 +355,7 @@
 
 		case CTL_TAB:
 		    {
-			int i = root->cti_value - 1;
+			int i = root->cti_value;
 			if (i < 0) {
 				fprintf(stderr, "%s:%d: "
 					"invalid tab index %d\n",
@@ -1181,28 +1181,6 @@
 			if (cp1->ct_next != cp)
 				continue;
 			p = cp->ctc_value;
-			if (p && *p == '\t') {
-				int tab_depth;
-
-				tab_depth = 0;
-				p++;
-				while (*p == '\t') {
-					tab_depth++;
-					p++;
-				}
-				if (p) {
-					char *tmp;
-
-					tmp = cp->ctc_value;
-					p = cp->ctc_value = strdup(p);
-					free(tmp);
-				}
-
-				if (tab_control[tab_depth]) {
-					ctlinsert(&cp1->ct_next,
-					    ctlcopy(tab_control[tab_depth]));
-				}
-			}
 			/* special: style escape */
 			if (p && *p == '&') {
 				char *p0;
@@ -1236,6 +1214,27 @@
 					    ctlcopy(tab_control[i]->ct_next));
 				}
 				free(tmp);
+			}
+			if (p && (*p == '\t' || tab_control[0])) {
+				int tab_depth;
+
+				tab_depth = 0;
+				while (*p == '\t') {
+					tab_depth++;
+					p++;
+				}
+				if (p) {
+					char *tmp;
+
+					tmp = cp->ctc_value;
+					p = cp->ctc_value = strdup(p);
+					free(tmp);
+				}
+
+				if (tab_control[tab_depth]) {
+					ctlinsert(&cp1->ct_next,
+					    ctlcopy(tab_control[tab_depth]));
+				}
 			}
 		}
 	}