Add CBT (cursor back tab) sequence, from Crystal Kolipe kolipe.c at
authornicm <nicm@openbsd.org>
Thu, 12 Jan 2023 12:34:06 +0000 (12:34 +0000)
committernicm <nicm@openbsd.org>
Thu, 12 Jan 2023 12:34:06 +0000 (12:34 +0000)
exoticsilicon dot com.

ok miod

sys/dev/wscons/wsemul_vt100_subr.c

index b68d94b..44f0aef 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100_subr.c,v 1.27 2023/01/12 12:28:08 nicm Exp $ */
+/* $OpenBSD: wsemul_vt100_subr.c,v 1.28 2023/01/12 12:34:06 nicm Exp $ */
 /* $NetBSD: wsemul_vt100_subr.c,v 1.7 2000/04/28 21:56:16 mycroft Exp $ */
 
 /*
@@ -217,7 +217,7 @@ int
 wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp,
     struct wsemul_inputstate *instate)
 {
-       int n, help, flags, fgcol, bgcol;
+       int n, m, help, flags, fgcol, bgcol;
        uint32_t attr, bkgdattr;
        u_char c;
        int rc = 0;
@@ -517,6 +517,22 @@ wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp,
                WSEMULOP(rc, edp, &edp->abortstate, erasecols,
                    ERASECOLS(edp->ccol, n, edp->bkgdattr));
                break;
+       case 'Z': /* CBT */
+               if (edp->ccol == 0)
+                       break;
+               for (m = 0; m < DEF1_ARG(0); m++) {
+                       if (edp->tabs) {
+                               for (n = edp->ccol - 1; n > 0; n--) {
+                                       if (edp->tabs[n])
+                                               break;
+                               }
+                       } else
+                               n = (edp->ccol - 1) & ~7;
+                       edp->ccol = n;
+                       if (n == 0)
+                               break;
+               }
+               break;
        case 'c': /* DA primary */
                if (ARG(0) == 0)
                        wsdisplay_emulinput(edp->cbcookie, WSEMUL_VT_ID1,