+42
-25
lines changedFilter options
+42
-25
lines changed Original file line number Diff line number Diff line change
@@ -439,22 +439,6 @@ static HandleState handle_bracketed_paste(TermInput *input)
439
439
return kNotApplicable;
440
440
}
441
441
442
-
// ESC NUL => <Esc>
443
-
static bool handle_forced_escape(TermInput *input)
444
-
{
445
-
if (rbuffer_size(input->read_stream.buffer) > 1
446
-
&& !rbuffer_cmp(input->read_stream.buffer, "\x1b\x00", 2)) {
447
-
// skip the ESC and NUL and push one <esc> to the input buffer
448
-
size_t rcnt;
449
-
termkey_push_bytes(input->tk, rbuffer_read_ptr(input->read_stream.buffer,
450
-
&rcnt), 1);
451
-
rbuffer_consumed(input->read_stream.buffer, 2);
452
-
tk_getkeys(input, true);
453
-
return true;
454
-
}
455
-
return false;
456
-
}
457
-
458
442
static void set_bg_deferred(void **argv)
459
443
{
460
444
char *bgvalue = argv[0];
@@ -583,7 +567,6 @@ static void handle_raw_buffer(TermInput *input, bool force)
583
567
if (!force
584
568
&& (handle_focus_event(input)
585
569
|| (is_paste = handle_bracketed_paste(input)) != kNotApplicable
586
-
|| handle_forced_escape(input)
587
570
|| (is_bc = handle_background_color(input)) != kNotApplicable)) {
588
571
if (is_paste == kIncomplete || is_bc == kIncomplete) {
589
572
// Wait for the next input, leaving it in the raw buffer due to an
Original file line number Diff line number Diff line change
@@ -7,7 +7,9 @@ local nvim_dir = helpers.nvim_dir
7
7
local feed_command, nvim = helpers.feed_command, helpers.nvim
8
8
9
9
local function feed_data(data)
10
-
nvim('set_var', 'term_data', data)
10
+
-- A string containing NUL bytes is not converted to a Blob when
11
+
-- calling nvim_set_var() API, so convert it using Lua instead.
12
+
nvim('exec_lua', 'vim.g.term_data = ...', {data})
11
13
nvim('command', 'call jobsend(b:terminal_job_id, term_data)')
12
14
end
13
15
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ describe('TUI', function()
214
214
]])
215
215
end)
216
216
217
-
it('interprets ESC+key as ALT chord', function()
217
+
it('interprets ESC+key as ALT chord in i_CTRL-V', function()
218
218
-- Vim represents ALT/META by setting the "high bit" of the modified key:
219
219
-- ALT+j inserts "ê". Nvim does not (#3982).
220
220
feed_data('i\022\027j')
@@ -229,6 +229,38 @@ describe('TUI', function()
229
229
]])
230
230
end)
231
231
232
+
it('interprets <Esc>[27u as <Esc>', function()
233
+
feed_command('nnoremap <M-;> <Nop>')
234
+
feed_command('nnoremap <Esc> AESC<Esc>')
235
+
feed_command('nnoremap ; Asemicolon<Esc>')
236
+
feed_data('\027[27u;')
237
+
screen:expect([[
238
+
ESCsemicolo{1:n} |
239
+
{4:~ }|
240
+
{4:~ }|
241
+
{4:~ }|
242
+
{5:[No Name] [+] }|
243
+
|
244
+
{3:-- TERMINAL --} |
245
+
]])
246
+
-- <Esc>; should be recognized as <M-;> when <M-;> is mapped
247
+
feed_data('\027;')
248
+
screen:expect_unchanged()
249
+
end)
250
+
251
+
it('interprets <Esc><Nul> as <M-C-Space> #17198', function()
252
+
feed_data('i\022\027\000')
253
+
screen:expect([[
254
+
<M-C-Space>{1: } |
255
+
{4:~ }|
256
+
{4:~ }|
257
+
{4:~ }|
258
+
{5:[No Name] [+] }|
259
+
{3:-- INSERT --} |
260
+
{3:-- TERMINAL --} |
261
+
]])
262
+
end)
263
+
232
264
it('accepts ASCII control sequences', function()
233
265
feed_data('i')
234
266
feed_data('\022\007') -- ctrl+g
@@ -271,7 +303,7 @@ describe('TUI', function()
271
303
{3:-- TERMINAL --} |
272
304
]])
273
305
feed_data('\027[201~') -- End paste.
274
-
feed_data('\027\000') -- ESC: go to Normal mode.
306
+
feed_data('\027[27u') -- ESC: go to Normal mode.
275
307
wait_for_mode('n')
276
308
screen:expect([[
277
309
"pasted from termina{1:l}" |
@@ -453,7 +485,7 @@ describe('TUI', function()
453
485
{3:-- TERMINAL --} |
454
486
]]}
455
487
-- Dot-repeat/redo.
456
-
feed_data('\027\000')
488
+
feed_data('\027[27u')
457
489
wait_for_mode('n')
458
490
feed_data('.')
459
491
screen:expect{grid=[[
@@ -499,7 +531,7 @@ describe('TUI', function()
499
531
vim.paste = function(lines, phase) error("fake fail") end
500
532
]], {})
501
533
-- Prepare something for dot-repeat/redo.
502
-
feed_data('ifoo\n\027\000')
534
+
feed_data('ifoo\n\027[27u')
503
535
wait_for_mode('n')
504
536
screen:expect{grid=[[
505
537
foo |
@@ -541,7 +573,7 @@ describe('TUI', function()
541
573
{3:-- TERMINAL --} |
542
574
]]}
543
575
-- Editor should still work after failed/drained paste.
544
-
feed_data('ityped input...\027\000')
576
+
feed_data('ityped input...\027[27u')
545
577
screen:expect{grid=[[
546
578
foo |
547
579
foo |
@@ -575,7 +607,7 @@ describe('TUI', function()
575
607
vim.paste = function(lines, phase) return false end
576
608
]], {})
577
609
feed_data('\027[200~line A\nline B\n\027[201~')
578
-
feed_data('ifoo\n\027\000')
610
+
feed_data('ifoo\n\027[27u')
579
611
expect_child_buf_lines({'foo',''})
580
612
end)
581
613
@@ -669,7 +701,7 @@ describe('TUI', function()
669
701
{3:-- INSERT --} |
670
702
{3:-- TERMINAL --} |
671
703
]])
672
-
feed_data('\027\000') -- ESC: go to Normal mode.
704
+
feed_data('\027[27u') -- ESC: go to Normal mode.
673
705
wait_for_mode('n')
674
706
-- Dot-repeat/redo.
675
707
feed_data('.')
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