[5341] in Athena Bugs
Re: enhancements to xman; part 2 -- "tabbing"
daemon@ATHENA.MIT.EDU (vanharen@ATHENA.MIT.EDU)
Thu Jun 28 14:26:51 1990
From: vanharen@ATHENA.MIT.EDU
Date: Thu, 28 Jun 90 14:26:31 -0400
To: bugs@ATHENA.MIT.EDU
In-Reply-To: [5338] in bugs
oops. I submitted the patches for "enhancements, part 1" instead of the
correct patch below. OK, so it was 5:12am, give me a break...
==============================================================================
*** ScrollByL.c Thu Jun 28 04:42:36 1990
--- ScrollByL.c.4 Thu Jun 28 04:50:30 1990
***************
*** 2,8 ****
* xman - X window system manual page display program.
*
* $XConsortium: ScrollByL.c,v 1.13 90/01/11 20:09:00 keith Exp $
! * $Header: /site/usr/local/xman.src/RCS/ScrollByL.c,v 1.3 90/06/28 03:36:11 vanharen Exp $
*
* Copyright 1987, 1988 Massachusetts Institute of Technology
*
--- 2,8 ----
* xman - X window system manual page display program.
*
* $XConsortium: ScrollByL.c,v 1.13 90/01/11 20:09:00 keith Exp $
! * $Header: /site/usr/local/xman.src/RCS/ScrollByL.c,v 1.4 90/06/09 01:28:10 vanharen Exp $
*
* Copyright 1987, 1988 Massachusetts Institute of Technology
*
***************
*** 915,920 ****
--- 915,934 ----
int peek;
/*
+ * For table hack
+ * To get columns to line up reasonably in most cases, make the
+ * assumption that they were lined up using lots of spaces, where
+ * lots is greater than two. Use a space width of 60% of the
+ * widest character in the font.
+ */
+ XFontStruct * h_font;
+ int h_width, h_col;
+ char * h_c;
+
+ h_font = sblw->scroll.normal_font;
+ h_width = (6 * h_font->max_bounds.width) / 10; /* a guess */
+
+ /*
* Nothing loaded, take no action.
*/
***************
*** 947,952 ****
--- 961,967 ----
bufp = buf;
x_loc = sblw->scroll.offset + sblw->scroll.indent;
+ h_col = 0;
/*
* Assume that we are always starting to print on or before the
***************
*** 1003,1008 ****
--- 1018,1024 ----
italicflag = FALSE;
x_loc = sblw->scroll.offset + sblw->scroll.indent;
y_loc += sblw->scroll.font_height;
+ h_col = 0;
break;
/*
***************
*** 1014,1024 ****
case '\t': /* TAB */
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
WHICH(italicflag, first));
bufp = buf;
italicflag = FALSE;
! x_loc += width - (x_loc % width);
break;
case '\033': /* ignore esc sequences for now */
c++; /* should always be esc-x */
break;
--- 1030,1066 ----
case '\t': /* TAB */
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
WHICH(italicflag, first));
+ h_col += bufp - buf;
bufp = buf;
italicflag = FALSE;
! x_loc = sblw->scroll.offset + sblw->scroll.indent;
! h_col = h_col + 8 - (h_col%8);
! x_loc += h_width * h_col;
break;
+ case ' ':
+ h_c = c + 1;
+ while (*h_c == ' ') h_c++;
+
+ if (h_c - c < 3)
+ {
+ *bufp++ = *c;
+ break;
+ }
+
+ x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
+ WHICH(italicflag, first));
+ h_col += bufp - buf;
+ bufp = buf;
+ italicflag = FALSE;
+
+ x_loc = sblw->scroll.offset + sblw->scroll.indent;
+ h_col += (h_c - c);
+ x_loc += h_width * h_col;
+ c = h_c - 1;
+
+ break;
+
case '\033': /* ignore esc sequences for now */
c++; /* should always be esc-x */
break;
***************
*** 1034,1043 ****
--- 1076,1087 ----
if (bufp > buf) {
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
WHICH(italicflag, FALSE));
+ h_col += bufp - buf;
bufp = buf;
}
*bufp++ = c[1];
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, BOLD);
+ h_col += bufp - buf;
bufp = buf;
first = FALSE;
***************
*** 1060,1068 ****
--- 1104,1114 ----
bufp--;
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
WHICH(italicflag, FALSE));
+ h_col += bufp - buf;
bufp = buf;
*bufp = (char)183;
x_loc = DumpText(w, x_loc, y_loc, buf, 1, SYMBOL);
+ h_col++;
c++;
}
else { /* 'real' backspace - back up output ptr */
***************
*** 1078,1083 ****
--- 1124,1130 ----
if(!italicflag) { /* font change? */
if (bufp != buf) {
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, NORMAL);
+ h_col += bufp - buf;
bufp = buf;
}
italicflag = TRUE;
***************
*** 1093,1098 ****
--- 1140,1146 ----
if (bufp != buf) {
x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf,
WHICH(italicflag, FALSE));
+ h_col += bufp - buf;
bufp = buf;
}
italicflag = FALSE;