diff options
-rw-r--r-- | src/nvim/message.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_menu.vim | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 621a9212df..7cccd046c9 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1748,8 +1748,8 @@ const char *str2special(const char **const sp, const bool replace_spaces, const *sp = str + 1; } } else { - // single-byte character or illegal byte - *sp = str + 1; + // single-byte character, NUL or illegal byte + *sp = str + (*str == NUL ? 0 : 1); } // Make special keys and C0 control characters in <> form, also <M-Space>. diff --git a/src/nvim/testdir/test_menu.vim b/src/nvim/testdir/test_menu.vim index c85da7f5b1..a759ab6d05 100644 --- a/src/nvim/testdir/test_menu.vim +++ b/src/nvim/testdir/test_menu.vim @@ -530,4 +530,17 @@ func Test_tmenu() tunmenu Test endfunc +func Test_only_modifier() + exe "tmenu a.b \x80\xfc0" + let exp =<< trim [TEXT] + --- Menus --- + 500 a + 500 b + t - <T-2-^@> + [TEXT] + call assert_equal(exp, split(execute('tmenu'), "\n")) + + tunmenu a.b +endfunc + " vim: shiftwidth=2 sts=2 expandtab |