aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-01-21 18:04:40 +0100
committerGitHub <noreply@github.com>2022-01-21 18:04:40 +0100
commite07a4b97f6552674f6038d15c0767bbfea082bf2 (patch)
tree479eed2cc5ce0afea43e239848e934b9a6df2c11 /src/nvim/os/input.c
parentbe22cc1264ba27ed46f8ef3123c532d721478607 (diff)
parent6e69a3c3e79fd78b31753343213e68e73b0048c4 (diff)
downloadrneovim-e07a4b97f6552674f6038d15c0767bbfea082bf2.tar.gz
rneovim-e07a4b97f6552674f6038d15c0767bbfea082bf2.tar.bz2
rneovim-e07a4b97f6552674f6038d15c0767bbfea082bf2.zip
Merge pull request #16936 from zeertzjq/no-escape-csi
input: never escape CSI bytes and clean up related names and comments
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r--src/nvim/os/input.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 3790eba212..54cfaee80a 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -234,9 +234,9 @@ size_t input_enqueue(String keys)
while (rbuffer_space(input_buffer) >= 19 && ptr < end) {
// A "<x>" form occupies at least 1 characters, and produces up
// to 19 characters (1 + 5 * 3 for the char and 3 for a modifier).
- // In the case of K_SPECIAL(0x80) or CSI(0x9B), 3 bytes are escaped and
- // needed, but since the keys are UTF-8, so the first byte cannot be
- // K_SPECIAL(0x80) or CSI(0x9B).
+ // In the case of K_SPECIAL(0x80), 3 bytes are escaped and needed,
+ // but since the keys are UTF-8, so the first byte cannot be
+ // K_SPECIAL(0x80).
uint8_t buf[19] = { 0 };
unsigned int new_size
= trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true,
@@ -263,12 +263,8 @@ size_t input_enqueue(String keys)
continue;
}
- // copy the character, escaping CSI and K_SPECIAL
- if ((uint8_t)*ptr == CSI) {
- rbuffer_write(input_buffer, (char *)&(uint8_t){ K_SPECIAL }, 1);
- rbuffer_write(input_buffer, (char *)&(uint8_t){ KS_EXTRA }, 1);
- rbuffer_write(input_buffer, (char *)&(uint8_t){ KE_CSI }, 1);
- } else if ((uint8_t)*ptr == K_SPECIAL) {
+ // copy the character, escaping K_SPECIAL
+ if ((uint8_t)(*ptr) == K_SPECIAL) {
rbuffer_write(input_buffer, (char *)&(uint8_t){ K_SPECIAL }, 1);
rbuffer_write(input_buffer, (char *)&(uint8_t){ KS_SPECIAL }, 1);
rbuffer_write(input_buffer, (char *)&(uint8_t){ KE_FILLER }, 1);