mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #13244 from tk-shirasaka/fix/multigrid-click-foldcolumn
ui: Fix click on foldcolumn when ext_multigrid is enabled
This commit is contained in:
commit
e786fb5afb
@ -75,6 +75,7 @@ int jump_to_mouse(int flags,
|
||||
int grid = mouse_grid;
|
||||
int mouse_char;
|
||||
int fdc = 0;
|
||||
ScreenGrid *gp = &default_grid;
|
||||
|
||||
mouse_past_bottom = false;
|
||||
mouse_past_eol = false;
|
||||
@ -125,16 +126,6 @@ retnomove:
|
||||
if (flags & MOUSE_SETPOS)
|
||||
goto retnomove; // ugly goto...
|
||||
|
||||
// Remember the character under the mouse, might be one of foldclose or
|
||||
// foldopen fillchars in the fold column.
|
||||
if (row >= 0 && row < Rows && col >= 0 && col <= Columns
|
||||
&& default_grid.chars != NULL) {
|
||||
mouse_char = utf_ptr2char(default_grid.chars[default_grid.line_offset[row]
|
||||
+ (unsigned)col]);
|
||||
} else {
|
||||
mouse_char = ' ';
|
||||
}
|
||||
|
||||
old_curwin = curwin;
|
||||
old_cursor = curwin->w_cursor;
|
||||
|
||||
@ -333,6 +324,19 @@ retnomove:
|
||||
}
|
||||
}
|
||||
|
||||
// Remember the character under the mouse, might be one of foldclose or
|
||||
// foldopen fillchars in the fold column.
|
||||
if (ui_has(kUIMultigrid)) {
|
||||
gp = &curwin->w_grid;
|
||||
}
|
||||
if (row >= 0 && row < Rows && col >= 0 && col <= Columns
|
||||
&& gp->chars != NULL) {
|
||||
mouse_char = utf_ptr2char(gp->chars[gp->line_offset[row]
|
||||
+ (unsigned)col]);
|
||||
} else {
|
||||
mouse_char = ' ';
|
||||
}
|
||||
|
||||
// Check for position outside of the fold column.
|
||||
if (curwin->w_p_rl ? col < curwin->w_width_inner - fdc :
|
||||
col >= fdc + (cmdwin_type == 0 ? 0 : 1)) {
|
||||
|
@ -10,11 +10,16 @@ local source = helpers.source
|
||||
local assert_alive = helpers.assert_alive
|
||||
|
||||
describe("folded lines", function()
|
||||
before_each(function()
|
||||
clear()
|
||||
end)
|
||||
|
||||
local function with_ext_multigrid(multigrid)
|
||||
local screen
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(45, 8)
|
||||
screen:attach({rgb=true})
|
||||
screen:attach({rgb=true, ext_multigrid=multigrid})
|
||||
screen:set_default_attr_ids({
|
||||
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||
[2] = {reverse = true},
|
||||
@ -32,6 +37,29 @@ describe("folded lines", function()
|
||||
command("set signcolumn=yes:9")
|
||||
feed("i<cr><esc>")
|
||||
feed("vkzf")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7: }{5:^+-- 2 lines: ·············}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7: }{5:^+-- 2 lines: ·············}|
|
||||
{1:~ }|
|
||||
@ -42,6 +70,7 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
|
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
||||
it("highlighting with relative line numbers", function()
|
||||
@ -52,6 +81,29 @@ describe("folded lines", function()
|
||||
funcs.setline(3, '{{{1')
|
||||
funcs.setline(4, 'line 2')
|
||||
feed("j")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:+ }{8: 1 }{5:+-- 2 lines: ·························}|
|
||||
{7:+ }{9: 0 }{5:^+-- 2 lines: ·························}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:set foldcolumn=2 |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:+ }{8: 1 }{5:+-- 2 lines: ·························}|
|
||||
{7:+ }{9: 0 }{5:^+-- 2 lines: ·························}|
|
||||
@ -62,6 +114,7 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
:set foldcolumn=2 |
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
||||
it("works with multibyte fillchars", function()
|
||||
@ -78,7 +131,30 @@ describe("folded lines", function()
|
||||
feed('zf4j')
|
||||
feed('zf2j')
|
||||
feed('zO')
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:▾▾}^aa |
|
||||
{7:││}bb |
|
||||
{7:││}cc |
|
||||
{7:││}dd |
|
||||
{7:││}ee |
|
||||
{7:│ }ff |
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:1 |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:▾▾}^aa |
|
||||
{7:││}bb |
|
||||
{7:││}cc |
|
||||
@ -87,10 +163,34 @@ describe("folded lines", function()
|
||||
{7:│ }ff |
|
||||
{1:~ }|
|
||||
:1 |
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set rightleft")
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
a^a{7:▾▾}|
|
||||
bb{7:││}|
|
||||
cc{7:││}|
|
||||
dd{7:││}|
|
||||
ee{7:││}|
|
||||
ff{7: │}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set rightleft |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
a^a{7:▾▾}|
|
||||
bb{7:││}|
|
||||
cc{7:││}|
|
||||
@ -99,11 +199,36 @@ describe("folded lines", function()
|
||||
ff{7: │}|
|
||||
{1: ~}|
|
||||
:set rightleft |
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set norightleft")
|
||||
if multigrid then
|
||||
meths.input_mouse('left', 'press', '', 2, 0, 1)
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:▾▸}{5:^+--- 5 lines: aa··························}|
|
||||
{7:│ }ff |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:set norightleft |
|
||||
]])
|
||||
else
|
||||
meths.input_mouse('left', 'press', '', 0, 0, 1)
|
||||
screen:expect{grid=[[
|
||||
screen:expect([[
|
||||
{7:▾▸}{5:^+--- 5 lines: aa··························}|
|
||||
{7:│ }ff |
|
||||
{1:~ }|
|
||||
@ -112,7 +237,8 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
:set norightleft |
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
||||
it("works with multibyte text", function()
|
||||
@ -122,6 +248,29 @@ describe("folded lines", function()
|
||||
insert([[
|
||||
å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة
|
||||
möre text]])
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
|
||||
möre tex^t |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
|
||||
möre tex^t |
|
||||
@ -132,9 +281,33 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
|
|
||||
]])
|
||||
end
|
||||
|
||||
feed('vkzf')
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
@ -143,9 +316,33 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set noarabicshape")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:set noarabicshape |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
|
||||
{1:~ }|
|
||||
@ -156,8 +353,32 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
:set noarabicshape |
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set number foldcolumn=2")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة···········}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:set number foldcolumn=2 |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة···········}|
|
||||
{1:~ }|
|
||||
@ -168,9 +389,33 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
:set number foldcolumn=2 |
|
||||
]])
|
||||
end
|
||||
|
||||
-- Note: too much of the folded line gets cut off.This is a vim bug.
|
||||
feed_command("set rightleft")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:···········ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}{8: 1 }{7: +}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set rightleft |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:···········ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}{8: 1 }{7: +}|
|
||||
{1: ~}|
|
||||
@ -181,8 +426,32 @@ describe("folded lines", function()
|
||||
{1: ~}|
|
||||
:set rightleft |
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set nonumber foldcolumn=0")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set nonumber foldcolumn=0 |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
|
||||
{1: ~}|
|
||||
@ -193,8 +462,32 @@ describe("folded lines", function()
|
||||
{1: ~}|
|
||||
:set nonumber foldcolumn=0 |
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command("set arabicshape")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set arabicshape |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
|
||||
{1: ~}|
|
||||
@ -205,8 +498,32 @@ describe("folded lines", function()
|
||||
{1: ~}|
|
||||
:set arabicshape |
|
||||
]])
|
||||
end
|
||||
|
||||
feed('zo')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å|
|
||||
txet eröm|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set arabicshape |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å|
|
||||
txet eröm|
|
||||
@ -217,8 +534,32 @@ describe("folded lines", function()
|
||||
{1: ~}|
|
||||
:set arabicshape |
|
||||
]])
|
||||
end
|
||||
|
||||
feed_command('set noarabicshape')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å|
|
||||
txet eröm|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
{1: ~}|
|
||||
## grid 3
|
||||
:set noarabicshape |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å|
|
||||
txet eröm|
|
||||
@ -229,6 +570,7 @@ describe("folded lines", function()
|
||||
{1: ~}|
|
||||
:set noarabicshape |
|
||||
]])
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
@ -239,6 +581,28 @@ describe("folded lines", function()
|
||||
feed_command("/omega")
|
||||
|
||||
feed("<cr>q:")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
{2:[No Name] }|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
{3:[Command Line] }|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
|
|
||||
## grid 3
|
||||
: |
|
||||
## grid 4
|
||||
{1::}set foldmethod=manual |
|
||||
{1::}let x = 1 |
|
||||
{1::}^ |
|
||||
{1:~ }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
|
|
||||
{2:[No Name] }|
|
||||
@ -249,8 +613,31 @@ describe("folded lines", function()
|
||||
{3:[Command Line] }|
|
||||
: |
|
||||
]])
|
||||
end
|
||||
|
||||
feed("kzfk")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
{2:[No Name] }|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
[4:---------------------------------------------]|
|
||||
{3:[Command Line] }|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
|
|
||||
## grid 3
|
||||
: |
|
||||
## grid 4
|
||||
{1::}{5:^+-- 2 lines: set foldmethod=manual·········}|
|
||||
{1::} |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
|
|
||||
{2:[No Name] }|
|
||||
@ -261,8 +648,32 @@ describe("folded lines", function()
|
||||
{3:[Command Line] }|
|
||||
: |
|
||||
]])
|
||||
end
|
||||
|
||||
feed("<cr>")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
: |
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
@ -273,8 +684,31 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
: |
|
||||
]])
|
||||
end
|
||||
|
||||
feed("/<c-f>")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
{2:[No Name] }|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
{3:[Command Line] }|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
|
|
||||
## grid 3
|
||||
/ |
|
||||
## grid 5
|
||||
{1:/}alpha |
|
||||
{1:/}{6:omega} |
|
||||
{1:/}^ |
|
||||
{1:~ }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
|
|
||||
{2:[No Name] }|
|
||||
@ -285,8 +719,31 @@ describe("folded lines", function()
|
||||
{3:[Command Line] }|
|
||||
/ |
|
||||
]])
|
||||
end
|
||||
|
||||
feed("ggzfG")
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
{2:[No Name] }|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
[5:---------------------------------------------]|
|
||||
{3:[Command Line] }|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
|
|
||||
## grid 3
|
||||
/ |
|
||||
## grid 5
|
||||
{1:/}{5:^+-- 3 lines: alpha·························}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
|
|
||||
{2:[No Name] }|
|
||||
@ -297,6 +754,7 @@ describe("folded lines", function()
|
||||
{3:[Command Line] }|
|
||||
/ |
|
||||
]])
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
@ -309,7 +767,30 @@ describe("folded lines", function()
|
||||
|
||||
feed("zfj")
|
||||
command("set foldcolumn=0")
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:^+-- 2 lines: line 1·························}|
|
||||
line 3 |
|
||||
line 4 |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:^+-- 2 lines: line 1·························}|
|
||||
line 3 |
|
||||
line 4 |
|
||||
@ -318,10 +799,34 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
-- should adapt to the current nesting of folds (e.g., 1)
|
||||
command("set foldcolumn=auto:1")
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:+}{5:^+-- 2 lines: line 1························}|
|
||||
{7: }line 3 |
|
||||
{7: }line 4 |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:+}{5:^+-- 2 lines: line 1························}|
|
||||
{7: }line 3 |
|
||||
{7: }line 4 |
|
||||
@ -330,11 +835,35 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
-- fdc should not change with a new fold as the maximum is 1
|
||||
feed("zf3j")
|
||||
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:+}{5:^+-- 4 lines: line 1························}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:+}{5:^+-- 4 lines: line 1························}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
@ -343,12 +872,36 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
|
||||
-- relax the maximum fdc thus fdc should expand to
|
||||
-- accomodate the current number of folds
|
||||
command("set foldcolumn=auto:4")
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{7:+ }{5:^+-- 4 lines: line 1·······················}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{7:+ }{5:^+-- 4 lines: line 1·······················}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
@ -357,7 +910,8 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
||||
it('does not crash when foldtext is longer than columns #12988', function()
|
||||
@ -369,7 +923,30 @@ describe("folded lines", function()
|
||||
command('set foldtext=MyFoldText()')
|
||||
feed("i<cr><esc>")
|
||||
feed("vkzf")
|
||||
screen:expect{grid=[[
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
[3:---------------------------------------------]|
|
||||
## grid 2
|
||||
{5:^---------------------------------------------}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
{5:^---------------------------------------------}|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
@ -378,7 +955,17 @@ describe("folded lines", function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
]])
|
||||
end
|
||||
assert_alive()
|
||||
end)
|
||||
end
|
||||
|
||||
describe("with ext_multigrid", function()
|
||||
with_ext_multigrid(true)
|
||||
end)
|
||||
|
||||
describe('without ext_multigrid', function()
|
||||
with_ext_multigrid(false)
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user