jcs
/subtext
/amendments
/79
ansi: Add ANSI_FORWARD_N
jcs made amendment 79 over 2 years ago
--- ansi.c Tue Dec 28 17:41:19 2021
+++ ansi.c Mon Feb 21 15:24:00 2022
@@ -90,24 +90,24 @@ ansi(struct session *s, ...)
break;
/* these require N args */
- case ANSI_UP_N:
+ case ANSI_DOWN_N:
if (s->vt100) {
- sprintf(ansi_tmp, "\33[%dF", va_arg(ap, short));
+ sprintf(ansi_tmp, "\33[%dB", va_arg(ap, short));
len = strlcat(ansi_out, ansi_tmp, sizeof(ansi_buf[0]));
} else if (s->vt52) {
val = va_arg(ap, short);
for (n = 0; n < val; n++)
- len = strlcat(ansi_out, "\33A", sizeof(ansi_buf[0]));
+ len = strlcat(ansi_out, "\33B", sizeof(ansi_buf[0]));
}
break;
- case ANSI_DOWN_N:
+ case ANSI_FORWARD_N:
if (s->vt100) {
- sprintf(ansi_tmp, "\33[%dB", va_arg(ap, short));
+ sprintf(ansi_tmp, "\33[%dC", va_arg(ap, short));
len = strlcat(ansi_out, ansi_tmp, sizeof(ansi_buf[0]));
} else if (s->vt52) {
val = va_arg(ap, short);
for (n = 0; n < val; n++)
- len = strlcat(ansi_out, "\33B", sizeof(ansi_buf[0]));
+ len = strlcat(ansi_out, "\33C", sizeof(ansi_buf[0]));
}
break;
case ANSI_BACK_N:
@@ -118,6 +118,16 @@ ansi(struct session *s, ...)
val = va_arg(ap, short);
for (n = 0; n < val; n++)
len = strlcat(ansi_out, "\33D", sizeof(ansi_buf[0]));
+ }
+ break;
+ case ANSI_UP_N:
+ if (s->vt100) {
+ sprintf(ansi_tmp, "\33[%dF", va_arg(ap, short));
+ len = strlcat(ansi_out, ansi_tmp, sizeof(ansi_buf[0]));
+ } else if (s->vt52) {
+ val = va_arg(ap, short);
+ for (n = 0; n < val; n++)
+ len = strlcat(ansi_out, "\33A", sizeof(ansi_buf[0]));
}
break;
case ANSI_INSERT_LINES_N:
--- ansi.h Tue Dec 28 17:41:38 2021
+++ ansi.h Mon Feb 21 15:24:45 2022
@@ -31,9 +31,10 @@ enum {
ANSI_RESTORE_SAVED_CURSOR,
/* these require N args */
- ANSI_UP_N,
ANSI_DOWN_N,
+ ANSI_FORWARD_N,
ANSI_BACK_N,
+ ANSI_UP_N,
ANSI_COL_N,
ANSI_CURSOR_LINE_COL,
ANSI_INSERT_LINES_N,