45 lines
1.2 KiB
Diff
45 lines
1.2 KiB
Diff
From 27efc62f5d86afcb2ecb7565587fe8dea4b036fe Mon Sep 17 00:00:00 2001
|
|
From: Bram Moolenaar <Bram@vim.org>
|
|
Date: Fri, 1 Jul 2022 16:35:45 +0100
|
|
Subject: [PATCH] patch 9.0.0018: going over the end of the typahead
|
|
|
|
Problem: Going over the end of the typahead.
|
|
Solution: Put a NUL after the typeahead.
|
|
---
|
|
src/term.c | 1 +
|
|
src/testdir/test_mapping.vim | 9 +++++++++
|
|
2 files changed, 10 insertions(+)
|
|
|
|
diff --git a/src/term.c b/src/term.c
|
|
index 307e3bf..ee80f0f 100644
|
|
--- a/src/term.c
|
|
+++ b/src/term.c
|
|
@@ -4419,6 +4419,7 @@ check_termcode(
|
|
if (*tp == ESC && !p_ek && (State & INSERT))
|
|
continue;
|
|
|
|
+ tp[len] = NUL;
|
|
key_name[0] = NUL; // no key name found yet
|
|
key_name[1] = NUL; // no key name found yet
|
|
modifiers = 0; // no modifiers yet
|
|
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim
|
|
index d3abaff..55e6af0 100644
|
|
--- a/src/testdir/test_mapping.vim
|
|
+++ b/src/testdir/test_mapping.vim
|
|
@@ -492,3 +492,12 @@ func Test_expr_map_restore_cursor()
|
|
call StopVimInTerminal(buf)
|
|
call delete('XtestExprMap')
|
|
endfunc
|
|
+
|
|
+func Test_using_past_typeahead()
|
|
+ nnoremap :00 0
|
|
+ exe "norm :set \x80\xfb0=0\<CR>"
|
|
+ exe "sil norm :0\x0f\<C-U>\<CR>"
|
|
+
|
|
+ exe "norm :set \x80\xfb0=\<CR>"
|
|
+ nunmap :00
|
|
+endfunc
|
|
--
|
|
1.8.3.1
|
|
|