diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-17 13:33:31 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-17 13:33:31 +0200 |
commit | a6ce8f3ab5edeb8a788eb99a806459b56576d242 (patch) | |
tree | 415ee1041537d0e81ccd5cfb70c4a2f2d3f174a0 /libterminput.c | |
parent | Reject surrogates in CSI u (diff) | |
download | libterminput-a6ce8f3ab5edeb8a788eb99a806459b56576d242.tar.gz libterminput-a6ce8f3ab5edeb8a788eb99a806459b56576d242.tar.bz2 libterminput-a6ce8f3ab5edeb8a788eb99a806459b56576d242.tar.xz |
Fix and test CSI u1.0.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libterminput.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libterminput.c b/libterminput.c index 136f898..cb946d0 100644 --- a/libterminput.c +++ b/libterminput.c @@ -139,7 +139,7 @@ encode_utf8(unsigned long long int codepoint, char buffer[7]) len += 1; buffer[len] = '\0'; for (; --len; codepoint >>= 6) - buffer[len] = (char)(codepoint & 0x3FULL); + buffer[len] = (char)((codepoint & 0x3FULL) | 0x80ULL); buffer[0] |= (char)codepoint; } @@ -467,7 +467,7 @@ parse_sequence(union libterminput_input *input, struct libterminput_state *ctx) input->mouseevent.y = (size_t)nums[1] + (size_t)!nums[1]; break; case 'u': - if (nums[0] > 0x10FFFFULL || (nums[0] & 0xD800) == 0xD800) { + if (nums[0] > 0x10FFFFULL || (nums[0] & 0xFFF800ULL) == 0xD800ULL) { input->type = LIBTERMINPUT_NONE; break; } |