aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-09 07:59:32 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-09 07:59:32 +0000
commitfd6a99d73849190531e8e36abbb60308afad05ff (patch)
treeff3e00cb4c97a168de7c4fc962902c0ee94c1b62
parentMerge branch 'no-more-linear' (diff)
vt: handle UTF-8 sequences in OSC PUT
This is strictly speaking not correct, since we're not treating a lot of characters that should switch state as part of the OSC string. The correct way would be to have a specific OSC UTF8 state that parses UTF8 strings.
-rw-r--r--vt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/vt.c b/vt.c
index 7ce2ddcb..431d1d00 100644
--- a/vt.c
+++ b/vt.c
@@ -328,15 +328,21 @@ static const struct state_transition state_csi_ignore[256] = {
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
};
-static const struct state_transition state_ocs_string[256] = {
+static const struct state_transition state_osc_string[256] = {
[0x00 ... 0x06] = {.action = ACTION_IGNORE},
[0x07] = { .state = STATE_GROUND},
[0x08 ... 0x17] = {.action = ACTION_IGNORE},
[0x19] = {.action = ACTION_IGNORE},
[0x1c ... 0x1f] = {.action = ACTION_IGNORE},
+ [0x20 ... 0xff] = {.action = ACTION_OSC_PUT},
+#if 0
[0x20 ... 0x7f] = {.action = ACTION_OSC_PUT},
[0x9c] = { .state = STATE_GROUND},
+ [0xc0 ... 0xdf] = {.action = ACTION_OSC_PUT},
+ [0xe0 ... 0xef] = {.action = ACTION_OSC_PUT},
+ [0xf0 ... 0xf7] = {.action = ACTION_OSC_PUT},
+
/* Anywhere */
[0x18] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
[0x1a] = {.action = ACTION_EXECUTE, .state = STATE_GROUND},
@@ -351,6 +357,7 @@ static const struct state_transition state_ocs_string[256] = {
[0x9c] = { .state = STATE_GROUND},
[0x9d] = { .state = STATE_OSC_STRING},
[0x9e ... 0x9f] = { .state = STATE_SOS_PM_APC_STRING},
+#endif
};
static const struct state_transition state_dcs_entry[256] = {
@@ -510,7 +517,7 @@ static const struct state_transition* states[] = {
[STATE_CSI_PARAM] = state_csi_param,
[STATE_CSI_INTERMEDIATE] = state_csi_intermediate,
[STATE_CSI_IGNORE] = state_csi_ignore,
- [STATE_OSC_STRING] = state_ocs_string,
+ [STATE_OSC_STRING] = state_osc_string,
[STATE_DCS_ENTRY] = state_dcs_entry,
[STATE_DCS_PARAM] = state_dcs_param,
[STATE_DCS_INTERMEDIATE] = state_dcs_intermediate,