mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
fix(sign): avoid deleting from sign map while looping over it (#27158)
This commit is contained in:
parent
932c7eb019
commit
fcd9905291
@ -1021,9 +1021,14 @@ static void sign_get_placed(buf_T *buf, linenr_T lnum, int id, const char *group
|
||||
void free_signs(void)
|
||||
{
|
||||
cstr_t name;
|
||||
kvec_t(cstr_t) names = KV_INITIAL_VALUE;
|
||||
map_foreach_key(&sign_map, name, {
|
||||
sign_undefine_by_name(name);
|
||||
kv_push(names, name);
|
||||
});
|
||||
for (size_t i = 0; i < kv_size(names); i++) {
|
||||
sign_undefine_by_name(kv_A(names, i));
|
||||
}
|
||||
kv_destroy(names);
|
||||
}
|
||||
|
||||
static enum {
|
||||
|
@ -1,6 +1,7 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear, feed, exec, api = helpers.clear, helpers.feed, helpers.exec, helpers.api
|
||||
local api, clear, eq = helpers.api, helpers.clear, helpers.eq
|
||||
local eval, exec, feed = helpers.eval, helpers.exec, helpers.feed
|
||||
|
||||
describe('Signs', function()
|
||||
local screen
|
||||
@ -565,4 +566,13 @@ describe('Signs', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('sign_undefine() frees all signs', function()
|
||||
exec([[
|
||||
sign define 1 text=1
|
||||
sign define 2 text=2
|
||||
call sign_undefine()
|
||||
]])
|
||||
eq({}, eval('sign_getdefined()'))
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user