0
0
mirror of https://github.com/vim/vim.git synced 2025-10-05 05:34:07 -04:00

patch 8.2.4924: maparg() may return a string that cannot be reused

Problem:    maparg() may return a string that cannot be reused.
Solution:   use msg_outtrans_special() instead of str2special().
            (closes #10384)
This commit is contained in:
zeertzjq
2022-05-09 12:16:19 +01:00
committed by Bram Moolenaar
parent 194843028e
commit 0519ce0039
6 changed files with 60 additions and 21 deletions

View File

@@ -58,6 +58,20 @@ func Test_maparg()
map abc y<S-char-114>y
call assert_equal("yRy", maparg('abc'))
" character with K_SPECIAL byte
nmap abc
call assert_equal('…', maparg('abc'))
" modified character with K_SPECIAL byte
nmap abc <M->
call assert_equal('<M-…>', maparg('abc'))
" illegal bytes
let str = ":\x7f:\x80:\x90:\xd0:"
exe 'nmap abc ' .. str
call assert_equal(str, maparg('abc'))
unlet str
omap { w
let d = maparg('{', 'o', 0, 1)
call assert_equal(['{', 'w', 'o'], [d.lhs, d.rhs, d.mode])