aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-10 16:45:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-10 16:45:12 +0000
commitcf71534768b01e2a94a8f8f13faca2fb1920e93e (patch)
tree68e116565169d0f3f1d79315df8c2f1ab39d7fc6 /csi.c
parentscrollback: in debug, verify all rows in the view are initialized (diff)
terminal: remove 'blink' attribute from cell struct
This makes the other attribute bits fit in a single uint8_t, which makes each cell smaller which improves cache usage.
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/csi.c b/csi.c
index 3311b7b3..51f7705d 100644
--- a/csi.c
+++ b/csi.c
@@ -79,6 +79,33 @@ sgr_reset(struct terminal *term)
term->vt.attrs.background = term->background;
}
+static const char *
+csi_as_string(struct terminal *term, uint8_t final)
+{
+ static char msg[1024];
+ int c = snprintf(msg, sizeof(msg), "CSI: ");
+
+ if (term->vt.private != 0)
+ c += snprintf(&msg[c], sizeof(msg) - c, "%c", term->vt.private);
+
+ for (size_t i = 0; i < term->vt.params.idx; i++){
+ c += snprintf(&msg[c], sizeof(msg) - c, "%d",
+ term->vt.params.v[i].value);
+
+ for (size_t j = 0; i < term->vt.params.v[i].sub.idx; j++) {
+ c += snprintf(&msg[c], sizeof(msg) - c, ":%d",
+ term->vt.params.v[i].sub.value[j]);
+ }
+
+ c += snprintf(&msg[c], sizeof(msg) - c, "%s",
+ i == term->vt.params.idx - 1 ? "" : ";");
+ }
+
+ c += snprintf(&msg[c], sizeof(msg) - c, "%c (%zu parameters)",
+ final, term->vt.params.idx);
+ return msg;
+}
+
static void
csi_sgr(struct terminal *term)
{
@@ -99,8 +126,8 @@ csi_sgr(struct terminal *term)
case 2: term->vt.dim = true; break;
case 3: term->vt.attrs.italic = true; break;
case 4: term->vt.attrs.underline = true; break;
- case 5: term->vt.attrs.blink = true; break;
- case 6: term->vt.attrs.blink = true; break;
+ case 5: LOG_WARN("unimplemented: %s (blink)", csi_as_string(term, 'm')); /*term->vt.attrs.blink = true; */break;
+ case 6: break; /* rapid blink, ignored */
case 7: term->vt.attrs.reverse = true; break;
case 8: term->vt.attrs.conceal = true; break;
case 9: term->vt.attrs.strikethrough = true; break;
@@ -108,7 +135,8 @@ csi_sgr(struct terminal *term)
case 22: term->vt.attrs.bold = term->vt.dim = false; break;
case 23: term->vt.attrs.italic = false; break;
case 24: term->vt.attrs.underline = false; break;
- case 25: term->vt.attrs.blink = false; break;
+ case 25: /*term->vt.attrs.blink = false; */break;
+ case 26: break; /* rapid blink, ignored */
case 27: term->vt.attrs.reverse = false; break;
case 28: term->vt.attrs.conceal = false; break;
case 29: term->vt.attrs.strikethrough = false; break;
@@ -239,33 +267,6 @@ csi_sgr(struct terminal *term)
}
}
-static const char *
-csi_as_string(struct terminal *term, uint8_t final)
-{
- static char msg[1024];
- int c = snprintf(msg, sizeof(msg), "CSI: ");
-
- if (term->vt.private != 0)
- c += snprintf(&msg[c], sizeof(msg) - c, "%c", term->vt.private);
-
- for (size_t i = 0; i < term->vt.params.idx; i++){
- c += snprintf(&msg[c], sizeof(msg) - c, "%d",
- term->vt.params.v[i].value);
-
- for (size_t j = 0; i < term->vt.params.v[i].sub.idx; j++) {
- c += snprintf(&msg[c], sizeof(msg) - c, ":%d",
- term->vt.params.v[i].sub.value[j]);
- }
-
- c += snprintf(&msg[c], sizeof(msg) - c, "%s",
- i == term->vt.params.idx - 1 ? "" : ";");
- }
-
- c += snprintf(&msg[c], sizeof(msg) - c, "%c (%zu parameters)",
- final, term->vt.params.idx);
- return msg;
-}
-
void
csi_dispatch(struct terminal *term, uint8_t final)
{