A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/ff7c3d12750b1cd4baccea0baeafe7e5d5339e94 below:

never escape CSI bytes · neovim/neovim@ff7c3d1 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+28

-14

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+28

-14

lines changed Original file line number Diff line number Diff line change

@@ -1010,12 +1010,11 @@ void ins_char_typebuf(int c)

1010 1010

buf[utf_char2bytes(c, buf)] = NUL;

1011 1011

char_u *p = buf;

1012 1012

while (*p) {

1013 -

if ((uint8_t)(*p) == CSI || (uint8_t)(*p) == K_SPECIAL) {

1014 -

bool is_csi = (uint8_t)(*p) == CSI;

1013 +

if ((uint8_t)(*p) == K_SPECIAL) {

1015 1014

memmove(p + 3, p + 1, STRLEN(p + 1) + 1);

1016 1015

*p++ = K_SPECIAL;

1017 -

*p++ = is_csi ? KS_EXTRA : KS_SPECIAL;

1018 -

*p++ = is_csi ? KE_CSI : KE_FILLER;

1016 +

*p++ = KS_SPECIAL;

1017 +

*p++ = KE_FILLER;

1019 1018

} else {

1020 1019

p++;

1021 1020

}

Original file line number Diff line number Diff line change

@@ -234,9 +234,9 @@ size_t input_enqueue(String keys)

234 234

while (rbuffer_space(input_buffer) >= 19 && ptr < end) {

235 235

// A "<x>" form occupies at least 1 characters, and produces up

236 236

// to 19 characters (1 + 5 * 3 for the char and 3 for a modifier).

237 -

// In the case of K_SPECIAL(0x80) or CSI(0x9B), 3 bytes are escaped and

238 -

// needed, but since the keys are UTF-8, so the first byte cannot be

239 -

// K_SPECIAL(0x80) or CSI(0x9B).

237 +

// In the case of K_SPECIAL(0x80), 3 bytes are escaped and needed,

238 +

// but since the keys are UTF-8, so the first byte cannot be

239 +

// K_SPECIAL(0x80).

240 240

uint8_t buf[19] = { 0 };

241 241

unsigned int new_size

242 242

= trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true,

@@ -263,12 +263,8 @@ size_t input_enqueue(String keys)

263 263

continue;

264 264

}

265 265 266 -

// copy the character, escaping CSI and K_SPECIAL

267 -

if ((uint8_t)*ptr == CSI) {

268 -

rbuffer_write(input_buffer, (char *)&(uint8_t){ K_SPECIAL }, 1);

269 -

rbuffer_write(input_buffer, (char *)&(uint8_t){ KS_EXTRA }, 1);

270 -

rbuffer_write(input_buffer, (char *)&(uint8_t){ KE_CSI }, 1);

271 -

} else if ((uint8_t)*ptr == K_SPECIAL) {

266 +

// copy the character, escaping K_SPECIAL

267 +

if ((uint8_t)(*ptr) == K_SPECIAL) {

272 268

rbuffer_write(input_buffer, (char *)&(uint8_t){ K_SPECIAL }, 1);

273 269

rbuffer_write(input_buffer, (char *)&(uint8_t){ KS_SPECIAL }, 1);

274 270

rbuffer_write(input_buffer, (char *)&(uint8_t){ KE_FILLER }, 1);

Original file line number Diff line number Diff line change

@@ -114,11 +114,30 @@ describe('mappings', function()

114 114

end)

115 115

end)

116 116 117 -

describe('input utf sequences that contain CSI/K_SPECIAL', function()

117 +

describe('input utf sequences that contain K_SPECIAL (0x80)', function()

118 118

it('ok', function()

119 119

feed('i…<esc>')

120 120

expect('')

121 121

end)

122 + 123 +

it('can be mapped', function()

124 +

command('inoremap … E280A6')

125 +

feed('i…<esc>')

126 +

expect('E280A6')

127 +

end)

128 +

end)

129 + 130 +

describe('input utf sequences that contain CSI (0x9B)', function()

131 +

it('ok', function()

132 +

feed('iě<esc>')

133 +

expect('ě')

134 +

end)

135 + 136 +

it('can be mapped', function()

137 +

command('inoremap ě C49B')

138 +

feed('iě<esc>')

139 +

expect('C49B')

140 +

end)

122 141

end)

123 142 124 143

describe('input non-printable chars', function()

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4