mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -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;
|
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
|
// cells taken by 'showbreak'/'breakindent' halfway current char
|
||||||
int head_mid = csarg->indent_width;
|
int head_mid = csarg->indent_width;
|
||||||
if (head_mid == INT_MIN) {
|
if (head_mid == INT_MIN) {
|
||||||
|
@ -412,9 +412,23 @@ describe('ext_multigrid', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
describe('grid of smaller inner size', function()
|
describe('grid of smaller inner size', function()
|
||||||
it('is rendered correctly', function()
|
before_each(function()
|
||||||
screen:try_resize_grid(2, 8, 5)
|
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=[[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[2:-----------------------------------------------------]|*12
|
[2:-----------------------------------------------------]|*12
|
||||||
@ -427,12 +441,43 @@ describe('ext_multigrid', function()
|
|||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
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)
|
end)
|
||||||
|
|
||||||
describe('grid of bigger inner size', function()
|
describe('grid of bigger inner size', function()
|
||||||
it('is rendered correctly', function()
|
before_each(function()
|
||||||
screen:try_resize_grid(2, 80, 20)
|
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=[[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[2:-----------------------------------------------------]|*12
|
[2:-----------------------------------------------------]|*12
|
||||||
@ -445,13 +490,6 @@ describe('ext_multigrid', function()
|
|||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
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()
|
it('winwidth() winheight() getwininfo() return inner width and height #19743', function()
|
||||||
eq(60, fn.winwidth(0))
|
eq(60, fn.winwidth(0))
|
||||||
@ -483,7 +521,7 @@ describe('ext_multigrid', function()
|
|||||||
]]}
|
]]}
|
||||||
end)
|
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')
|
command('set nowrap')
|
||||||
insert(('a'):rep(58) .. ('哦'):rep(3))
|
insert(('a'):rep(58) .. ('哦'):rep(3))
|
||||||
feed('0')
|
feed('0')
|
||||||
@ -543,6 +581,22 @@ describe('ext_multigrid', function()
|
|||||||
## grid 3
|
## 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)
|
end)
|
||||||
|
|
||||||
it('displays messages with default grid width', function()
|
it('displays messages with default grid width', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user