From: Bram Moolenaar Date: Sun, 10 Mar 2019 08:41:51 +0000 (+0100) Subject: patch 8.1.1003: playing back recorded key sequence mistakes key code X-Git-Tag: v8.1.1003 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6edbbd8114320089c0e603e033775d9dd34cb10a;p=vim patch 8.1.1003: playing back recorded key sequence mistakes key code Problem: Playing back recorded key sequence mistakes key code. Solution: Insert a after the . (closes #4068) --- diff --git a/src/getchar.c b/src/getchar.c index 4e5c8b68c..0e9942ba3 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2913,6 +2913,17 @@ vgetorpeek(int advance) if (gui.in_use && shape_changed) gui_update_cursor(TRUE, FALSE); #endif + if (timedout && c == ESC) + { + char_u nop_buf[3]; + + // When recording there will be no timeout. Add a after the ESC + // to avoid that it forms a key code with following characters. + nop_buf[0] = K_SPECIAL; + nop_buf[1] = KS_EXTRA; + nop_buf[2] = KE_NOP; + gotchars(nop_buf, 3); + } --vgetc_busy; diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim index 1ed0a66d1..b57555aed 100644 --- a/src/testdir/test_registers.vim +++ b/src/testdir/test_registers.vim @@ -146,3 +146,17 @@ func Test_register_one() bwipe! endfunc + +" Check that replaying a typed sequence does not use an Esc and following +" characters as an escape sequence. +func Test_recording_esc_sequence() + new + let save_F2 = &t_F2 + let t_F2 = "\OQ" + call feedkeys("qqiTest\", "xt") + call feedkeys("OQuirk\q", "xt") + call feedkeys("Go\@q", "xt") + call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4)) + bwipe! + let t_F2 = save_F2 +endfunc diff --git a/src/version.c b/src/version.c index 1d0f90dd1..5b1676032 100644 --- a/src/version.c +++ b/src/version.c @@ -779,6 +779,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1003, /**/ 1002, /**/