diff options
author | Shadman <shadmansaleh3@gmail.com> | 2025-03-28 13:09:02 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-28 15:09:02 +0800 |
commit | 18fa61049a9e19a3e8cbac73d963ac1dac251b39 (patch) | |
tree | 146579fa5f8c4372b71db7bd523940a805f48c25 /test | |
parent | edb9d0d21e0d2c93232932ee175739cedbcb5e28 (diff) | |
download | rneovim-18fa61049a9e19a3e8cbac73d963ac1dac251b39.tar.gz rneovim-18fa61049a9e19a3e8cbac73d963ac1dac251b39.tar.bz2 rneovim-18fa61049a9e19a3e8cbac73d963ac1dac251b39.zip |
fix(mouse): crash with click on win-separator in statusline (#33091)
Problem: Clicking on window separator in statusline crashes Nvim due
to out of bound memory access
Solution: Check if the click location is within clicking range before
applying it.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 3ee4d429c7..90b3094082 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1719,6 +1719,20 @@ describe('ui/mouse/input', function() ]]) end) + it("mouse click on window separator in statusline doesn't crash", function() + api.nvim_set_option_value('winwidth', 1, {}) + api.nvim_set_option_value('statusline', '%f', {}) + + command('vsplit') + command('redraw') + + local lines = api.nvim_get_option_value('lines', {}) + local columns = api.nvim_get_option_value('columns', {}) + + api.nvim_input_mouse('left', 'press', '', 0, lines - 1, math.floor(columns / 2)) + command('redraw') + end) + it('getmousepos() works correctly', function() local winwidth = api.nvim_get_option_value('winwidth', {}) -- Set winwidth=1 so that window sizes don't change. |