mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(plines): cursor position with 'showbreak' and resized grid (#28067)
This commit is contained in:
parent
981301d11f
commit
a0cbf1d8d5
@ -236,7 +236,7 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
|
||||
wcol += col_off_prev;
|
||||
}
|
||||
|
||||
if (wcol + size > wp->w_width) {
|
||||
if (wcol + size > wp->w_width_inner) {
|
||||
// cells taken by 'showbreak'/'breakindent' halfway current char
|
||||
int head_mid = csarg->indent_width;
|
||||
if (head_mid == INT_MIN) {
|
||||
|
@ -412,9 +412,23 @@ describe('ext_multigrid', function()
|
||||
end)
|
||||
|
||||
describe('grid of smaller inner size', function()
|
||||
it('is rendered correctly', function()
|
||||
screen:try_resize_grid(2, 8, 5)
|
||||
before_each(function()
|
||||
screen:try_resize_grid(2, 20, 5)
|
||||
end)
|
||||
|
||||
it('is rendered correctly', function()
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
{11:[No Name] }|
|
||||
[3:-----------------------------------------------------]|
|
||||
## grid 2
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
screen:try_resize_grid(2, 8, 5)
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
@ -427,12 +441,43 @@ describe('ext_multigrid', function()
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it("cursor draws correctly with double-width char and 'showbreak'", function()
|
||||
insert(('a'):rep(19) .. '哦bbbb')
|
||||
command('setlocal showbreak=++')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
{11:[No Name] [+] }|
|
||||
[3:-----------------------------------------------------]|
|
||||
## grid 2
|
||||
aaaaaaaaaaaaaaaaaaa{1:>}|
|
||||
{1:++}哦bbb^b |
|
||||
{1:~ }|*3
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('grid of bigger inner size', function()
|
||||
it('is rendered correctly', function()
|
||||
screen:try_resize_grid(2, 80, 20)
|
||||
before_each(function()
|
||||
screen:try_resize_grid(2, 60, 20)
|
||||
end)
|
||||
|
||||
it('is rendered correctly', function()
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
{11:[No Name] }|
|
||||
[3:-----------------------------------------------------]|
|
||||
## grid 2
|
||||
^ |
|
||||
{1:~ }|*19
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
screen:try_resize_grid(2, 80, 20)
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
@ -444,13 +489,6 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
describe('with resized grid', function()
|
||||
before_each(function()
|
||||
screen:try_resize_grid(2, 60, 20)
|
||||
end)
|
||||
|
||||
it('winwidth() winheight() getwininfo() return inner width and height #19743', function()
|
||||
@ -483,7 +521,7 @@ describe('ext_multigrid', function()
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('"g$" works correctly with double-width characters and no wrapping', function()
|
||||
it('g$ works correctly with double-width chars and no wrapping', function()
|
||||
command('set nowrap')
|
||||
insert(('a'):rep(58) .. ('哦'):rep(3))
|
||||
feed('0')
|
||||
@ -543,6 +581,22 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
command('setlocal breakindent breakindentopt=shift:8')
|
||||
feed('g$')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:-----------------------------------------------------]|*12
|
||||
{11:[No Name] [+] }|
|
||||
[3:-----------------------------------------------------]|
|
||||
## grid 2
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
|
||||
{23:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb^b}|
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
||||
|
|
||||
{1:~ }|*16
|
||||
## grid 3
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('displays messages with default grid width', function()
|
||||
|
Loading…
Reference in New Issue
Block a user