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

Fasttext bug fix



I found that if I tabbed to the end of a line on the fasttext device in
ST medium resolution, the cursor address was updated wrongly.  This was
because the calculation used to update the cursor address assumed that
the cursor would end up on an even x-coordinate.

I think there was a problem with high resolution too, but I can't try
it out!  I think the line

					j.i[1] = v->cx - v->maxx;

below should have had "-=" instead of "=".

Anyhow, the patch will just make the fasttext device recalculate the
address from scratch in this case, so there shouldn't be a problem in
any resolution.  I reckon this code is not called often enough for this
change to make a perceptible speed difference.

The patch below is relative to MH-MiNT v1.12h2.

--
Charles Briscoe-Smith
3rd Year student of Computer Science
University of Kent at Canterbury, United Kingdom, European Union.
World Wide Web:  http://aurora.etsiig.uniovi.es:3080/~~pippin/


--- fasttext.c.orig	Wed Jan 18 19:59:16 1995
+++ fasttext.c	Wed Jan 18 20:12:26 1995
@@ -1140,16 +1140,19 @@
 				j.i[1] = 8 - (v->cx & 7);
 				v->cx += j.i[1];
 				if (v->cx - v->maxx > 0) {
-					j.i[1] = v->cx - v->maxx;
 					v->cx = v->maxx;
+					/* Can't rely on the calc below,
+					 * so do it the safe way... */
+					v->cursaddr = PLACE(v, v->cx, v->cy);
+				} else {
+					v->cursaddr += j.l;
+					if ((i = v->planes-1)) {
+						if (j.l & 1)
+							j.i[1]++;
+						do v->cursaddr += j.l;
+						while (--i);
+					}
 				}
-				v->cursaddr += j.l;
-				if ((i = v->planes-1)) {
-					if (j.l & 1)
-						j.i[1]++;
-					do v->cursaddr += j.l;
-					while (--i);
-				}
 			}
 			return;
 		default:
~~ end ~~