Mercurial > vim
comparison src/testdir/test_map_functions.vim @ 28614:9ae2c32841fb v8.2.4831
patch 8.2.4831: crash when using maparg() and unmapping simplified keys
Commit: https://github.com/vim/vim/commit/2c8a7ebdad9da017bfb6dc8a0f46acea77ec2e17
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Apr 26 21:36:21 2022 +0100
patch 8.2.4831: crash when using maparg() and unmapping simplified keys
Problem: Crash when using maparg() and unmapping simplified keys.
Solution: Do not keep a mapblock pointer. (closes https://github.com/vim/vim/issues/10294)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 Apr 2022 22:45:03 +0200 |
parents | 398c5b3211f9 |
children | 38f7a132bba3 |
comparison
equal
deleted
inserted
replaced
28613:a56f5442fd9a | 28614:9ae2c32841fb |
---|---|
72 smap { w | 72 smap { w |
73 let d = maparg('{', 's', 0, 1) | 73 let d = maparg('{', 's', 0, 1) |
74 call assert_equal(['{', 'w', 's'], [d.lhs, d.rhs, d.mode]) | 74 call assert_equal(['{', 'w', 's'], [d.lhs, d.rhs, d.mode]) |
75 sunmap { | 75 sunmap { |
76 | 76 |
77 map <C-I> foo | |
78 unmap <Tab> | |
79 " This used to cause a segfault | |
80 call maparg('<C-I>', '', 0, 1) | |
81 unmap <C-I> | |
82 | |
77 map abc <Nop> | 83 map abc <Nop> |
78 call assert_equal("<Nop>", maparg('abc')) | 84 call assert_equal("<Nop>", maparg('abc')) |
79 unmap abc | 85 unmap abc |
80 | 86 |
81 call feedkeys(":abbr esc \<C-V>\<C-V>\<C-V>\<C-V>\<C-V>\<Esc>\<CR>", "xt") | 87 call feedkeys(":abbr esc \<C-V>\<C-V>\<C-V>\<C-V>\<C-V>\<Esc>\<CR>", "xt") |
82 let d = maparg('esc', 'i', 1, 1) | 88 let d = maparg('esc', 'i', 1, 1) |
83 call assert_equal(['esc', "\<C-V>\<C-V>\<Esc>", '!'], [d.lhs, d.rhs, d.mode]) | 89 call assert_equal(['esc', "\<C-V>\<C-V>\<Esc>", '!'], [d.lhs, d.rhs, d.mode]) |
84 abclear | 90 abclear |
91 unlet d | |
85 endfunc | 92 endfunc |
86 | 93 |
87 def Test_vim9_maparg() | 94 def Test_vim9_maparg() |
88 nmap { w | 95 nmap { w |
89 var one: string = maparg('{') | 96 var one: string = maparg('{') |