aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-02 10:36:41 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-05-02 12:04:49 +0800
commit37b73cf14b118ca1583da2a3e89611222bd3e020 (patch)
treeaa272c916cca3a514bb74b90d157c62fc018052c
parent03e8b5fc91f9b4b0535f79a8d725e1551aec6795 (diff)
downloadrneovim-37b73cf14b118ca1583da2a3e89611222bd3e020.tar.gz
rneovim-37b73cf14b118ca1583da2a3e89611222bd3e020.tar.bz2
rneovim-37b73cf14b118ca1583da2a3e89611222bd3e020.zip
fix(drawline): make cursorlineopt=screenline work with resized grid
-rw-r--r--src/nvim/drawline.c2
-rw-r--r--test/functional/ui/multigrid_spec.lua47
2 files changed, 46 insertions, 3 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 9bdf6a8255..9c6b5c3b8c 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -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;
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 7b2bf30642..9663997a71 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -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
|