wip: vt parsing: initial csi/osc dispatching

This commit is contained in:
Daniel Eklöf 2019-06-15 22:22:44 +02:00
parent 0e6aa61d69
commit 2a4c08b941
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
10 changed files with 571 additions and 103 deletions

70
terminal.h Normal file
View file

@ -0,0 +1,70 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
struct cell {
char c[5];
uint32_t foreground;
uint32_t background;
bool dirty;
};
struct grid {
int cols;
int rows;
int cell_width;
int cell_height;
int cursor;
struct cell *cells;
uint32_t foreground;
uint32_t background;
bool dirty;
bool all_dirty;
};
struct vt {
int state; /* enum state */
struct {
struct {
unsigned value;
struct {
unsigned value[16];
size_t idx;
} sub;
} v[16];
size_t idx;
} params;
struct {
uint8_t data[2];
size_t idx;
} intermediates;
struct {
uint8_t data[1024];
size_t idx;
} osc;
struct {
uint8_t data[4];
size_t idx;
size_t left;
} utf8;
bool bold;
bool dim;
bool italic;
bool underline;
bool strikethrough;
bool blink;
bool conceal;
bool reverse;
uint32_t foreground;
uint32_t background;
};
struct terminal {
struct vt vt;
struct grid grid;
};