From 295a264b65bd072bf858496e0e5de83d5b1f5ffa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 18 Jan 2023 15:12:45 +0800 Subject: fix(statusline): don't leak memory with zero-width click labels A zero-width click label isn't assigned to any click definition, so its function name should be freed when filling click definitions. --- test/functional/ui/statusline_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/functional') diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 549ebbde06..26a34f6d14 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -164,6 +164,16 @@ describe('statusline clicks', function() meths.input_mouse('right', 'press', '', 0, 6, 5) eq('0 1 r', eval("g:testvar")) end) + + it('no memory leak with zero-width click labels', function() + command([[ + let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@' + ]]) + meths.input_mouse('left', 'press', '', 0, 6, 0) + eq('0 1 l', eval("g:testvar")) + meths.input_mouse('right', 'press', '', 0, 6, 39) + eq('0 1 r', eval("g:testvar")) + end) end) describe('global statusline', function() -- cgit