fix(drawline): make cursorlineopt=screenline work with resized grid

This commit is contained in:
zeertzjq 2023-05-02 10:36:41 +08:00
parent 03e8b5fc91
commit 37b73cf14b
2 changed files with 46 additions and 3 deletions

View File

@ -168,7 +168,7 @@ static void margin_columns_win(win_T *wp, int *left_col, int *right_col)
return;
}
width1 = wp->w_width - cur_col_off;
width1 = wp->w_width_inner - cur_col_off;
width2 = width1 + win_col_off2(wp);
*left_col = 0;

View File

@ -39,6 +39,7 @@ describe('ext_multigrid', function()
[20] = {background = Screen.colors.LightGrey},
[21] = {background = Screen.colors.LightMagenta},
[22] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue},
[23] = {background = Screen.colors.Grey90},
})
end)
@ -930,7 +931,7 @@ describe('ext_multigrid', function()
end)
it('wraps with grid width', function()
insert(('b'):rep(80).."\n")
insert(('b'):rep(160).."\n")
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
@ -949,7 +950,8 @@ describe('ext_multigrid', function()
[3:-----------------------------------------------------]|
## grid 2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbb |
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
^ |
{1:~ }|
{1:~ }|
@ -967,6 +969,47 @@ describe('ext_multigrid', function()
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
]]}
feed('2gk')
command('setlocal cursorline cursorlineopt=screenline')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{23:^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb}|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|