[Bug 225096] [PATCH] Add reverse wrap around to libteken

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jan 12 11:36:08 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225096

--- Comment #1 from florian_kaiser at genua.de ---
unfortunately I lost some lines in the previous diff...
here is the updated patch:


diff -u -r -N teken/teken.c teken_/teken.c
--- teken/teken.c       2018-01-12 01:48:10.832926321 +0100
+++ teken_/teken.c      2018-01-12 01:50:08.108822290 +0100
@@ -58,6 +58,7 @@
 #define        TS_CONS25       0x0040  /* cons25 emulation. */
 #define        TS_INSTRING     0x0080  /* Inside string. */
 #define        TS_CURSORKEYS   0x0100  /* Cursor keys mode. */
+#define        TS_REVWRAP      0x0200  /* reverse Wraparound */

 /* Character that blanks a cell. */
 #define        BLANK   ' '
diff -u -r -N teken/teken_subr.h teken_/teken_subr.h
--- teken/teken_subr.h  2018-01-12 01:48:10.833926389 +0100
+++ teken_/teken_subr.h 2018-01-12 12:33:37.831931927 +0100
@@ -213,6 +213,16 @@
                } else {
                        t->t_cursor.tp_col--;
                }
+       } else if (t->t_stateflags & TS_REVWRAP)  {
+               if (t->t_cursor.tp_col == 0) {
+                       if (t->t_cursor.tp_row == t->t_originreg.ts_begin)
+                               return;
+                       t->t_cursor.tp_row--;
+                       t->t_cursor.tp_col = t->t_winsize.tp_col - 2;
+               } else {
+                       t->t_cursor.tp_col--;
+                       t->t_stateflags &= ~TS_WRAPPED;
+               }
        } else {
                if (t->t_cursor.tp_col == 0)
                        return;
@@ -934,7 +944,8 @@
                teken_printf("DECRST allow 132\n");
                break;
        case 45: /* Disable reverse wraparound. */
-               teken_printf("DECRST reverse wraparound\n");
+               t->t_stateflags &= ~TS_REVWRAP;
+               teken_printf("DECRST reverse wraparound disabled\n");
                break;
        case 47: /* Switch to alternate buffer. */
                teken_printf("Switch to alternate buffer\n");
@@ -1092,7 +1103,8 @@
                teken_printf("DECSET allow 132\n");
                break;
        case 45: /* Enable reverse wraparound. */
-               teken_printf("DECSET reverse wraparound\n");
+               t->t_stateflags |= TS_REVWRAP;
+               teken_printf("DECSET reverse wraparound enabled\n");
                break;
        case 47: /* Switch to alternate buffer. */
                teken_printf("Switch away from alternate buffer\n");

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list