Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jun 2005 23:47:13 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 78473 for review
Message-ID:  <200506122347.j5CNlDib022681@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=78473

Change 78473 by marcel@marcel_nfs on 2005/06/12 23:47:02

	Fix the tests that deal with scrolling. Improve the handling
	of wrap-around, although it's not completely fixed. This will
	be finished when vttest can be run, which requires input.

Affected files ...

.. //depot/projects/tty/sys/dev/vtc/vtc_te_vt102.c#4 edit

Differences ...

==== //depot/projects/tty/sys/dev/vtc/vtc_te_vt102.c#4 (text+ko) ====

@@ -83,17 +83,20 @@
 static __inline int
 vt102_repos(struct vt102_softc *vt102)
 {
+	int col;
 
-	vt102->wrap = 0;
+	col = vt102->col;
+	if (col == vt102->maxcol)
+		col--;
 	return (vtc_te_repos(&vt102->base, vt102->row << vt102->dh,
-		vt102->col << vt102->dw));
+		col << vt102->dw));
 }
 
 static __inline int
 vt102_newline(struct vt102_softc *vt102)
 {
 
-	if (vt102->row == vt102->maxrow)
+	if (vt102->row == vt102->maxrow - 1)
 		return (vtc_te_scroll(&vt102->base, 0, 0,
 			vt102->maxrow << vt102->dh, vt102->maxcol << vt102->dw,
 			1 << vt102->dh));
@@ -113,16 +116,17 @@
 
 	if (vt102->autowrap && vt102->wrap) {
 		vt102->col = 0;
+		vt102->wrap = 0;
 		vt102_newline(vt102);
 	}
-	vt102_putc(vt102, wc);
-	vt102->col++;
-	if (vt102->col > vt102->maxcol) {
-		vt102->col = vt102->maxcol;
-		if (vt102->autowrap)
+	if (vt102->col < vt102->maxcol) {
+		vt102_putc(vt102, wc);
+		vt102->col++;
+		if (vt102->col == vt102->maxcol && vt102->autowrap)
 			vt102->wrap = 1;
-	} else
-		vt102_repos(vt102);
+		else
+			vt102_repos(vt102);
+	}
 	return (0);
 }
 
@@ -141,15 +145,23 @@
 	case 0x08:	/* BS */
 		if (vt102->col > 0) {
 			vt102->col--;
+			vt102->wrap = 0;
 			vt102_putc(vt102, ' ');
 			vt102_repos(vt102);
 		}
 		break;
 	case 0x09:	/* HT */
+		if (vt102->autowrap && vt102->wrap) {
+			vt102->col = 0;
+			vt102->wrap = 0;
+			vt102_newline(vt102);
+		}
 		if (vt102->col < vt102->maxcol) {
 			vt102->col = (vt102->col + 8) & ~7;
 			if (vt102->col > vt102->maxcol)
 				vt102->col = vt102->maxcol;
+			if (vt102->col == vt102->maxcol && vt102->autowrap)
+				vt102->wrap = 1;
 			vt102_repos(vt102);
 		}
 		break;
@@ -161,6 +173,7 @@
 	case 0x0D:	/* CR */
 		if (vt102->col > 0) {
 			vt102->col = 0;
+			vt102->wrap = 0;
 			vt102_repos(vt102);
 		}
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506122347.j5CNlDib022681>