[RDY] Fix click on foldcolumn if it has tabline (#13982)

* Fix click on foldcolumn if it has tabline
* Fixes to correctly determine if tablie was clicked when multigrid is enabled
* Separate foldcolumn checks into functions
* Add test case for click on foldcolumn with split window
* Fix foldcolumn click used nvim_input() on multigrid enabled
This commit is contained in:
tk-shirasaka
2021-03-04 21:54:22 +09:00
committed by GitHub
parent df4440024b
commit f2fc44d50b
3 changed files with 413 additions and 29 deletions

View File

@@ -38,7 +38,9 @@ describe("folded lines", function()
[6] = {background = Screen.colors.Yellow},
[7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
[8] = {foreground = Screen.colors.Brown },
[9] = {bold = true, foreground = Screen.colors.Brown}
[9] = {bold = true, foreground = Screen.colors.Brown},
[10] = {background = Screen.colors.LightGrey, underline = true},
[11] = {bold=true},
})
end)
@@ -290,6 +292,369 @@ describe("folded lines", function()
end
end)
it("works with split", function()
insert([[
aa
bb
cc
dd
ee
ff]])
feed_command('2')
command("set foldcolumn=1")
feed('zf3j')
feed_command('1')
feed('zf2j')
feed('zO')
feed_command("rightbelow new")
insert([[
aa
bb
cc
dd
ee
ff]])
feed_command('2')
command("set foldcolumn=1")
feed('zf3j')
feed_command('1')
feed('zf2j')
if multigrid then
meths.input_mouse('left', 'press', '', 4, 0, 0)
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
{2:[No Name] [+] }|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
{3:[No Name] [+] }|
[3:---------------------------------------------]|
## grid 2
{7:-}aa |
{7:-}bb |
## grid 3
:1 |
## grid 4
{7:-}^aa |
{7:+}{5:+--- 4 lines: bb···························}|
{7:│}ff |
]])
else
meths.input_mouse('left', 'press', '', 0, 3, 0)
screen:expect([[
{7:-}aa |
{7:-}bb |
{2:[No Name] [+] }|
{7:-}^aa |
{7:+}{5:+--- 4 lines: bb···························}|
{7:│}ff |
{3:[No Name] [+] }|
:1 |
]])
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 1, 0)
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
{2:[No Name] [+] }|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
{3:[No Name] [+] }|
[3:---------------------------------------------]|
## grid 2
{7:-}aa |
{7:-}bb |
## grid 3
:1 |
## grid 4
{7:-}^aa |
{7:-}bb |
{7:2}cc |
]])
else
meths.input_mouse('left', 'press', '', 0, 4, 0)
screen:expect([[
{7:-}aa |
{7:-}bb |
{2:[No Name] [+] }|
{7:-}^aa |
{7:-}bb |
{7:2}cc |
{3:[No Name] [+] }|
:1 |
]])
end
if multigrid then
meths.input_mouse('left', 'press', '', 2, 1, 0)
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
{3:[No Name] [+] }|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
{2:[No Name] [+] }|
[3:---------------------------------------------]|
## grid 2
{7:-}aa |
{7:+}{5:^+--- 4 lines: bb···························}|
## grid 3
:1 |
## grid 4
{7:-}aa |
{7:-}bb |
{7:2}cc |
]])
else
meths.input_mouse('left', 'press', '', 0, 1, 0)
screen:expect([[
{7:-}aa |
{7:+}{5:^+--- 4 lines: bb···························}|
{3:[No Name] [+] }|
{7:-}aa |
{7:-}bb |
{7:2}cc |
{2:[No Name] [+] }|
:1 |
]])
end
if multigrid then
meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
{3:[No Name] [+] }|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
{2:[No Name] [+] }|
[3:---------------------------------------------]|
## grid 2
{7:+}{5:^+-- 6 lines: aa····························}|
{1:~ }|
## grid 3
:1 |
## grid 4
{7:-}aa |
{7:-}bb |
{7:2}cc |
]])
else
meths.input_mouse('left', 'press', '', 0, 0, 0)
screen:expect([[
{7:+}{5:^+-- 6 lines: aa····························}|
{1:~ }|
{3:[No Name] [+] }|
{7:-}aa |
{7:-}bb |
{7:2}cc |
{2:[No Name] [+] }|
:1 |
]])
end
end)
it("works with tab", function()
insert([[
aa
bb
cc
dd
ee
ff]])
feed_command('2')
command("set foldcolumn=2")
feed('zf3j')
feed_command('1')
feed('zf2j')
feed('zO')
feed_command("tab split")
if multigrid then
meths.input_mouse('left', 'press', '', 4, 1, 1)
screen:expect([[
## grid 1
{10: + [No Name] }{11: + [No Name] }{2: }{10:X}|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2 (hidden)
{7:- }aa |
{7:│-}bb |
{7:││}cc |
{7:││}dd |
{7:││}ee |
{7:│ }ff |
{1:~ }|
## grid 3
:tab split |
## grid 4
{7:- }^aa |
{7:│+}{5:+--- 4 lines: bb··························}|
{7:│ }ff |
{1:~ }|
{1:~ }|
{1:~ }|
]])
else
meths.input_mouse('left', 'press', '', 0, 2, 1)
screen:expect([[
{10: + [No Name] }{11: + [No Name] }{2: }{10:X}|
{7:- }^aa |
{7:│+}{5:+--- 4 lines: bb··························}|
{7:│ }ff |
{1:~ }|
{1:~ }|
{1:~ }|
:tab split |
]])
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 0, 0)
screen:expect([[
## grid 1
{10: + [No Name] }{11: + [No Name] }{2: }{10:X}|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[4:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2 (hidden)
{7:- }aa |
{7:│-}bb |
{7:││}cc |
{7:││}dd |
{7:││}ee |
{7:│ }ff |
{1:~ }|
## grid 3
:tab split |
## grid 4
{7:+ }{5:^+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
else
meths.input_mouse('left', 'press', '', 0, 1, 0)
screen:expect([[
{10: + [No Name] }{11: + [No Name] }{2: }{10:X}|
{7:+ }{5:^+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
:tab split |
]])
end
feed_command("tabnext")
if multigrid then
meths.input_mouse('left', 'press', '', 2, 1, 1)
screen:expect([[
## grid 1
{11: + [No Name] }{10: + [No Name] }{2: }{10:X}|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{7:- }^aa |
{7:│+}{5:+--- 4 lines: bb··························}|
{7:│ }ff |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
:tabnext |
## grid 4 (hidden)
{7:+ }{5:+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
else
meths.input_mouse('left', 'press', '', 0, 2, 1)
screen:expect([[
{11: + [No Name] }{10: + [No Name] }{2: }{10:X}|
{7:- }^aa |
{7:│+}{5:+--- 4 lines: bb··························}|
{7:│ }ff |
{1:~ }|
{1:~ }|
{1:~ }|
:tabnext |
]])
end
if multigrid then
meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect([[
## grid 1
{11: + [No Name] }{10: + [No Name] }{2: }{10:X}|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{7:+ }{5:^+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
:tabnext |
## grid 4 (hidden)
{7:+ }{5:+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]])
else
meths.input_mouse('left', 'press', '', 0, 1, 0)
screen:expect([[
{11: + [No Name] }{10: + [No Name] }{2: }{10:X}|
{7:+ }{5:^+-- 6 lines: aa···························}|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
:tabnext |
]])
end
end)
it("works with multibyte text", function()
-- Currently the only allowed value of 'maxcombine'
eq(6, meths.get_option('maxcombine'))