From a4b2400804355e99813f39a6b38d8f38667f8bdd Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 25 Apr 2023 05:05:04 +0200 Subject: fix(statusline): also allow right click when 'mousemodel' is "popup*" (#23258) Problem: The 'statusline'-format ui elements do not receive right click events when "mousemodel" is "popup*" Solution: Do not draw popupmenu and handle click event instead. --- test/functional/ui/mouse_spec.lua | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index f705678bd5..c7f6861c12 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1840,16 +1840,6 @@ describe('ui/mouse/input', function() eq({2, 9}, meths.win_get_cursor(0)) eq('', funcs.getreg('"')) - -- Try clicking on the status line - funcs.setreg('"', '') - meths.win_set_cursor(0, {1, 9}) - feed('vee') - meths.input_mouse('right', 'press', '', 0, 5, 1) - meths.input_mouse('right', 'release', '', 0, 5, 1) - feed('') - eq({1, 9}, meths.win_get_cursor(0)) - eq('ran away', funcs.getreg('"')) - -- Try clicking outside the window funcs.setreg('"', '') meths.win_set_cursor(0, {2, 1}) -- cgit From a3dfe1bc89a518442503189ca074ee8ab4b8b0d4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 27 Apr 2023 20:19:21 +0800 Subject: fix(pum): position properly with ext_multigrid (#23336) --- test/functional/ui/mouse_spec.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index c7f6861c12..d9b9cf9f1b 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1849,5 +1849,17 @@ describe('ui/mouse/input', function() feed('') eq(2, funcs.winnr()) eq('', funcs.getreg('"')) + + -- Test for right click in visual mode inside the selection with vertical splits + command('wincmd t') + command('rightbelow vsplit') + funcs.setreg('"', '') + meths.win_set_cursor(0, {1, 9}) + feed('vee') + meths.input_mouse('right', 'press', '', 0, 0, 52) + meths.input_mouse('right', 'release', '', 0, 0, 52) + feed('') + eq({1, 9}, meths.win_get_cursor(0)) + eq('ran away', funcs.getreg('"')) end) end) -- cgit From dc394b9641f92a5014147da58f5e14fd1681ec0f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 3 May 2023 10:29:19 +0800 Subject: fix(mouse): fix popup menu position check with winbar (#23456) --- test/functional/ui/mouse_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index d9b9cf9f1b..2c0a00c74f 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1861,5 +1861,16 @@ describe('ui/mouse/input', function() feed('') eq({1, 9}, meths.win_get_cursor(0)) eq('ran away', funcs.getreg('"')) + + -- Test for right click inside visual selection at bottom of window with winbar + command('setlocal winbar=WINBAR') + feed('2yyP') + funcs.setreg('"', '') + feed('G$vbb') + meths.input_mouse('right', 'press', '', 0, 4, 61) + meths.input_mouse('right', 'release', '', 0, 4, 61) + feed('') + eq({4, 20}, meths.win_get_cursor(0)) + eq('the moon', funcs.getreg('"')) end) end) -- cgit From 88cfb49bee3c9102082c7010acb92244e4ad1348 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 May 2023 07:14:39 +0800 Subject: vim-patch:8.2.4890: inconsistent capitalization in error messages Problem: Inconsistent capitalization in error messages. Solution: Make capitalization consistent. (Doug Kearns) https://github.com/vim/vim/commit/cf030578b26460643dca4a40e7f2e3bc19c749aa Co-authored-by: Bram Moolenaar --- test/functional/ui/mouse_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 2c0a00c74f..e55804e29f 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -790,7 +790,7 @@ describe('ui/mouse/input', function() feed('<0,0>') screen:expect([[ {6:E433: No tags file} | - {6:E426: tag not found: test}| + {6:E426: Tag not found: test}| {6:ing} | {7:Press ENTER or type comma}| {7:nd to continue}^ | -- cgit From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/ui/mouse_spec.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index e55804e29f..d8739e1c31 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -11,8 +11,8 @@ describe('ui/mouse/input', function() before_each(function() clear() - meths.set_option('mouse', 'a') - meths.set_option('list', true) + meths.set_option_value('mouse', 'a', {}) + meths.set_option_value('list', true, {}) -- NB: this is weird, but mostly irrelevant to the test -- So I didn't bother to change it command('set listchars=eol:$') @@ -64,7 +64,7 @@ describe('ui/mouse/input', function() end) it("in external ui works with unset 'mouse'", function() - meths.set_option('mouse', '') + meths.set_option_value('mouse', '', {}) feed('<2,1>') screen:expect{grid=[[ testing | @@ -379,7 +379,7 @@ describe('ui/mouse/input', function() end) it('left click in default tabline (position 24) closes tab', function() - meths.set_option('hidden', true) + meths.set_option_value('hidden', true, {}) feed_command('%delete') insert('this is foo') feed_command('silent file foo | tabnew | file bar') @@ -402,7 +402,7 @@ describe('ui/mouse/input', function() end) it('double click in default tabline (position 4) opens new tab', function() - meths.set_option('hidden', true) + meths.set_option_value('hidden', true, {}) feed_command('%delete') insert('this is foo') feed_command('silent file foo | tabnew | file bar') @@ -437,8 +437,8 @@ describe('ui/mouse/input', function() return call('Test', a:000 + [2]) endfunction ]]) - meths.set_option('tabline', '%@Test@test%X-%5@Test2@test2') - meths.set_option('showtabline', 2) + meths.set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {}) + meths.set_option_value('showtabline', 2, {}) screen:expect([[ {fill:test-test2 }| testing | @@ -786,7 +786,7 @@ describe('ui/mouse/input', function() end) it('ctrl + left click will search for a tag', function() - meths.set_option('tags', './non-existent-tags-file') + meths.set_option_value('tags', './non-existent-tags-file', {}) feed('<0,0>') screen:expect([[ {6:E433: No tags file} | @@ -1577,9 +1577,9 @@ describe('ui/mouse/input', function() end) it('getmousepos works correctly', function() - local winwidth = meths.get_option('winwidth') + local winwidth = meths.get_option_value('winwidth', {}) -- Set winwidth=1 so that window sizes don't change. - meths.set_option('winwidth', 1) + meths.set_option_value('winwidth', 1, {}) command('tabedit') local tabpage = meths.get_current_tabpage() insert('hello') @@ -1597,8 +1597,8 @@ describe('ui/mouse/input', function() } local float = meths.open_win(meths.get_current_buf(), false, opts) command('redraw') - local lines = meths.get_option('lines') - local columns = meths.get_option('columns') + local lines = meths.get_option_value('lines', {}) + local columns = meths.get_option_value('columns', {}) -- Test that screenrow and screencol are set properly for all positions. for row = 0, lines - 1 do @@ -1696,7 +1696,7 @@ describe('ui/mouse/input', function() -- Restore state and release mouse. command('tabclose!') - meths.set_option('winwidth', winwidth) + meths.set_option_value('winwidth', winwidth, {}) meths.input_mouse('left', 'release', '', 0, 0, 0) end) -- cgit From bf52fb7193ca08ceca292cfca9156380a6661979 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 12 Jul 2023 08:50:34 +0800 Subject: fix(mouse): copy the line before syntax matching (#24320) --- test/functional/ui/mouse_spec.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index d8739e1c31..621855f051 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1024,13 +1024,15 @@ describe('ui/mouse/input', function() }) feed('ggdG') - feed_command('set concealcursor=ni') - feed_command('set nowrap') - feed_command('set shiftwidth=2 tabstop=4 list') - feed_command('setl listchars=tab:>-') - feed_command('syntax match NonText "\\*" conceal') - feed_command('syntax match NonText "cats" conceal cchar=X') - feed_command('syntax match NonText "x" conceal cchar=>') + command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]]) + command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]]) + command([[syntax match X2 /cats/ conceal cchar=X contained]]) + -- No heap-use-after-free with multi-line syntax pattern #24317 + command([[syntax match X3 /\n\@<=x/ conceal cchar=>]]) + command([[highlight link X0 Normal]]) + command([[highlight link X1 NonText]]) + command([[highlight link X2 NonText]]) + command([[highlight link X3 NonText]]) -- First column is there to retain the tabs. insert([[ -- cgit From 5fb4c397a1da2737262ac7686666dc2596db50c2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 24 Jul 2023 18:16:53 +0800 Subject: fix(mouse): drag vsep of window with 'statuscolumn' (#24462) Problem: Cannot drag a vertical separator to the right of a window whose 'statuscolumn' is wider than itself. Solution: Never treat a click on a vertical separator as a click on 'statuscolumn'. --- test/functional/ui/mouse_spec.lua | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 621855f051..d126e27cde 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths local insert, feed_command = helpers.insert, helpers.feed_command local eq, funcs = helpers.eq, helpers.funcs +local poke_eventloop = helpers.poke_eventloop local command = helpers.command local exec = helpers.exec @@ -32,6 +33,7 @@ describe('ui/mouse/input', function() [5] = {bold = true, reverse = true}, [6] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, [7] = {bold = true, foreground = Screen.colors.SeaGreen4}, + [8] = {foreground = Screen.colors.Brown}, }) command("set mousemodel=extend") feed('itestingmousesupport and selection') @@ -798,6 +800,66 @@ describe('ui/mouse/input', function() feed('') end) + it('dragging vertical separator', function() + screen:try_resize(45, 5) + command('setlocal nowrap') + local oldwin = meths.get_current_win().id + command('rightbelow vnew') + screen:expect([[ + testing │{0:^$} | + mouse │{0:~ }| + support and selection │{0:~ }| + {4:[No Name] [+] }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'press', '', 0, 0, 22) + poke_eventloop() + meths.input_mouse('left', 'drag', '', 0, 1, 12) + screen:expect([[ + testing │{0:^$} | + mouse │{0:~ }| + support and │{0:~ }| + {4:< Name] [+] }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'drag', '', 0, 2, 2) + screen:expect([[ + te│{0:^$} | + mo│{0:~ }| + su│{0:~ }| + {4:< }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'release', '', 0, 2, 2) + meths.set_option_value('statuscolumn', 'foobar', { win = oldwin }) + screen:expect([[ + {8:fo}│{0:^$} | + {8:fo}│{0:~ }| + {8:fo}│{0:~ }| + {4:< }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'press', '', 0, 0, 2) + poke_eventloop() + meths.input_mouse('left', 'drag', '', 0, 1, 12) + screen:expect([[ + {8:foobar}testin│{0:^$} | + {8:foobar}mouse │{0:~ }| + {8:foobar}suppor│{0:~ }| + {4:< Name] [+] }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'drag', '', 0, 2, 22) + screen:expect([[ + {8:foobar}testing │{0:^$} | + {8:foobar}mouse │{0:~ }| + {8:foobar}support and sele│{0:~ }| + {4:[No Name] [+] }{5:[No Name] }| + | + ]]) + meths.input_mouse('left', 'release', '', 0, 2, 22) + end) + local function wheel(use_api) feed('ggdG') insert([[ -- cgit From 551998b7eed7dd411e4d14f65b108ae8a93c4081 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 18 Aug 2023 15:00:03 +0800 Subject: vim-patch:9.0.1725: cursor pos wrong after concealed text with 'virtualedit' Problem: Wrong cursor position when clicking after concealed text with 'virtualedit'. Solution: Store virtual columns in ScreenCols[] instead of text columns, and always use coladvance() when clicking. This also fixes incorrect curswant when clicking on a TAB, so now Test_normal_click_on_ctrl_char() asserts the same results as the ones before patch 9.0.0048. closes: vim/vim#12808 https://github.com/vim/vim/commit/e500ae8e29ad921378085f5d70ee5c0c537be1ba Remove the mouse_adjust_click() function. There is a difference in behavior with the old mouse_adjust_click() approach: when clicking on the character immediately after concealed text that is completely hidden, cursor is put on the clicked character rather than at the start of the concealed text. The new behavior is better, but it causes unnecessary scrolling in a functional test (which is an existing issue unrelated to these patches), so adjust the test. Now fully merged: vim-patch:9.0.0177: cursor position wrong with 'virtualedit' and mouse click --- test/functional/ui/mouse_spec.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index d126e27cde..657cc0c325 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1089,7 +1089,6 @@ describe('ui/mouse/input', function() command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]]) command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]]) command([[syntax match X2 /cats/ conceal cchar=X contained]]) - -- No heap-use-after-free with multi-line syntax pattern #24317 command([[syntax match X3 /\n\@<=x/ conceal cchar=>]]) command([[highlight link X0 Normal]]) command([[highlight link X1 NonText]]) @@ -1497,7 +1496,6 @@ describe('ui/mouse/input', function() ]]) end) -- level 2 - wrapped - it('(level 3) click on non-wrapped lines', function() feed_command('let &conceallevel=3', 'echo') @@ -1535,6 +1533,7 @@ describe('ui/mouse/input', function() ]]) feed('<20,2>') + feed('zH') -- FIXME: unnecessary horizontal scrolling screen:expect([[ Section{0:>>--->--->---}t1 | {0:>--->--->---} t2 t3 t4 | -- cgit From 1d3d50e8f0e1c3438ad77a8727ad8d3f1333c79a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 18 Aug 2023 19:31:15 +0800 Subject: test(ui/mouse_spec): mouse click with matchadd() concealed text --- test/functional/ui/mouse_spec.lua | 102 ++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 32 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 657cc0c325..9c22d112d3 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1073,38 +1073,7 @@ describe('ui/mouse/input', function() ]]) end) - describe('on concealed text', function() - -- Helpful for reading the test expectations: - -- :match Error /\^/ - - before_each(function() - screen:try_resize(25, 7) - screen:set_default_attr_ids({ - [0] = {bold=true, foreground=Screen.colors.Blue}, - c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }, - sm = {bold = true}, - }) - feed('ggdG') - - command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]]) - command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]]) - command([[syntax match X2 /cats/ conceal cchar=X contained]]) - command([[syntax match X3 /\n\@<=x/ conceal cchar=>]]) - command([[highlight link X0 Normal]]) - command([[highlight link X1 NonText]]) - command([[highlight link X2 NonText]]) - command([[highlight link X3 NonText]]) - - -- First column is there to retain the tabs. - insert([[ - |Section *t1* - | *t2* *t3* *t4* - |x 私は猫が大好き *cats* ✨🐈✨ - ]]) - - feed('ggGxgg') - end) - + local function test_mouse_click_conceal() it('(level 1) click on non-wrapped lines', function() feed_command('let &conceallevel=1', 'echo') @@ -1637,6 +1606,75 @@ describe('ui/mouse/input', function() ]]) end) -- level 3 - wrapped + end + + describe('on concealed text', function() + -- Helpful for reading the test expectations: + -- :match Error /\^/ + + before_each(function() + screen:try_resize(25, 7) + screen:set_default_attr_ids({ + [0] = { bold = true, foreground = Screen.colors.Blue }, + c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }, + sm = { bold = true }, + }) + feed('ggdG') + + command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]]) + command([[highlight link X0 Normal]]) + command([[highlight link X1 NonText]]) + command([[highlight link X2 NonText]]) + command([[highlight link X3 NonText]]) + + -- First column is there to retain the tabs. + insert([[ + |Section *t1* + | *t2* *t3* *t4* + |x 私は猫が大好き *cats* ✨🐈✨ + ]]) + + feed('ggGxgg') + end) + + describe('(syntax)', function() + before_each(function() + command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]]) + command([[syntax match X2 /cats/ conceal cchar=X contained]]) + command([[syntax match X3 /\n\@<=x/ conceal cchar=>]]) + end) + test_mouse_click_conceal() + end) + + describe('(matchadd())', function() + before_each(function() + funcs.matchadd('Conceal', [[\*]]) + funcs.matchadd('Conceal', [[cats]], 10, -1, { conceal = 'X' }) + funcs.matchadd('Conceal', [[\n\@<=x]], 10, -1, { conceal = '>' }) + end) + test_mouse_click_conceal() + end) + + -- FIXME: cannot make extmark conceal behave exactly like syntax conceal without cchar + pending('(extmarks)', function() + before_each(function() + local ns = meths.create_namespace('conceal') + meths.buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' }) + meths.buf_set_extmark(0, ns, 0, 14, { end_col = 15, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 5, { end_col = 6, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 8, { end_col = 9, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 10, { end_col = 11, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 13, { end_col = 14, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 15, { end_col = 16, conceal = '' }) + meths.buf_set_extmark(0, ns, 1, 18, { end_col = 19, conceal = '' }) + meths.buf_set_extmark(0, ns, 2, 24, { end_col = 25, conceal = '' }) + meths.buf_set_extmark(0, ns, 2, 29, { end_col = 30, conceal = '' }) + meths.buf_set_extmark(0, ns, 2, 25, { end_col = 29, conceal = 'X' }) + meths.buf_set_extmark(0, ns, 2, 0, { end_col = 1, conceal = '>' }) + end) + test_mouse_click_conceal() + end) + end) it('getmousepos works correctly', function() -- cgit From 5a6c7c805b8bb1d1ed9fe829ed33f18ffa6f4f47 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 19 Aug 2023 03:55:11 +0800 Subject: fix(extmarks): make empty "conceal" respect &conceallevel = 1 (#24785) This treats extmark conceal more like matchadd() conceal. --- test/functional/ui/mouse_spec.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 9c22d112d3..a8d01cfbf1 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1655,8 +1655,7 @@ describe('ui/mouse/input', function() test_mouse_click_conceal() end) - -- FIXME: cannot make extmark conceal behave exactly like syntax conceal without cchar - pending('(extmarks)', function() + describe('(extmarks)', function() before_each(function() local ns = meths.create_namespace('conceal') meths.buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' }) -- cgit From adb73772d9197a7fa6e9ee7a2e8874118e60844d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Sep 2023 08:00:03 +0800 Subject: vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits Problem: Wrong curswant when clicking on empty line or with vsplits. Solution: Don't check for ScreenCols[] before the start of the window and handle empty line properly. closes: vim/vim#13132 https://github.com/vim/vim/commit/03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb --- test/functional/ui/mouse_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index a8d01cfbf1..fd24174f74 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1676,7 +1676,7 @@ describe('ui/mouse/input', function() end) - it('getmousepos works correctly', function() + it('getmousepos() works correctly', function() local winwidth = meths.get_option_value('winwidth', {}) -- Set winwidth=1 so that window sizes don't change. meths.set_option_value('winwidth', 1, {}) @@ -1771,7 +1771,7 @@ describe('ui/mouse/input', function() -- Test that mouse position values are properly set for ordinary windows. -- Set the float to be unfocusable instead of closing, to additionally test - -- that getmousepos does not consider unfocusable floats. (see discussion + -- that getmousepos() does not consider unfocusable floats. (see discussion -- in PR #14937 for details). opts.focusable = false meths.win_set_config(float, opts) -- cgit From d974a3dcbb3757ebeb78fa64054c795ab7acdf1a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 15 Oct 2023 17:19:01 +0800 Subject: vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653) Problem: Cannot accurately get mouse clicking position when clicking on a TAB or with virtual text. Solution: Add a "coladd" field to getmousepos() result. closes: vim/vim#13335 https://github.com/vim/vim/commit/f5a94d5165bb9e390797da50a1fa7a87df3fbee4 --- test/functional/ui/mouse_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/functional/ui/mouse_spec.lua') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index fd24174f74..1356ba3db8 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1717,6 +1717,7 @@ describe('ui/mouse/input', function() eq(0, mousepos.wincol) eq(0, mousepos.line) eq(0, mousepos.column) + eq(0, mousepos.coladd) end end end @@ -1736,15 +1737,18 @@ describe('ui/mouse/input', function() eq(win_col + 1, mousepos.wincol) local line = 0 local column = 0 + local coladd = 0 if win_row > 0 and win_row < opts.height + 1 and win_col > 0 and win_col < opts.width + 1 then -- Because of border, win_row and win_col don't need to be -- incremented by 1. line = math.min(win_row, funcs.line('$')) column = math.min(win_col, #funcs.getline(line) + 1) + coladd = win_col - column end eq(line, mousepos.line) eq(column, mousepos.column) + eq(coladd, mousepos.coladd) end end @@ -1764,8 +1768,10 @@ describe('ui/mouse/input', function() eq(win_col + 1, mousepos.wincol) local line = math.min(win_row + 1, funcs.line('$')) local column = math.min(win_col + 1, #funcs.getline(line) + 1) + local coladd = win_col + 1 - column eq(line, mousepos.line) eq(column, mousepos.column) + eq(coladd, mousepos.coladd) end end @@ -1788,8 +1794,10 @@ describe('ui/mouse/input', function() eq(win_col + 1, mousepos.wincol) local line = math.min(win_row + 1, funcs.line('$')) local column = math.min(win_col + 1, #funcs.getline(line) + 1) + local coladd = win_col + 1 - column eq(line, mousepos.line) eq(column, mousepos.column) + eq(coladd, mousepos.coladd) end end end -- cgit