mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(screen): correctly draw background and eob with 'rightleft' (#22640)
This commit is contained in:
parent
1c4b3d41b5
commit
172227a446
@ -550,8 +550,7 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle
|
|||||||
|
|
||||||
if (bg_attr) {
|
if (bg_attr) {
|
||||||
for (int c = col; c < endcol; c++) {
|
for (int c = col; c < endcol; c++) {
|
||||||
linebuf_attr[off_from + (size_t)c] =
|
linebuf_attr[c] = hl_combine_attr(bg_attr, linebuf_attr[c]);
|
||||||
hl_combine_attr(bg_attr, linebuf_attr[off_from + (size_t)c]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,14 +111,14 @@ static int win_fill_end(win_T *wp, int c1, int c2, int off, int width, int row,
|
|||||||
int attr)
|
int attr)
|
||||||
{
|
{
|
||||||
int nn = off + width;
|
int nn = off + width;
|
||||||
|
const int endcol = wp->w_grid.cols;
|
||||||
|
|
||||||
if (nn > wp->w_grid.cols) {
|
if (nn > endcol) {
|
||||||
nn = wp->w_grid.cols;
|
nn = endcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_p_rl) {
|
if (wp->w_p_rl) {
|
||||||
grid_fill(&wp->w_grid, row, endrow, W_ENDCOL(wp) - nn, W_ENDCOL(wp) - off,
|
grid_fill(&wp->w_grid, row, endrow, endcol - nn, endcol - off, c1, c2, attr);
|
||||||
c1, c2, attr);
|
|
||||||
} else {
|
} else {
|
||||||
grid_fill(&wp->w_grid, row, endrow, off, nn, c1, c2, attr);
|
grid_fill(&wp->w_grid, row, endrow, off, nn, c1, c2, attr);
|
||||||
}
|
}
|
||||||
@ -156,13 +156,12 @@ void win_draw_end(win_T *wp, int c1, int c2, bool draw_margin, int row, int endr
|
|||||||
|
|
||||||
int attr = hl_combine_attr(win_bg_attr(wp), win_hl_attr(wp, (int)hl));
|
int attr = hl_combine_attr(win_bg_attr(wp), win_hl_attr(wp, (int)hl));
|
||||||
|
|
||||||
|
const int endcol = wp->w_grid.cols;
|
||||||
if (wp->w_p_rl) {
|
if (wp->w_p_rl) {
|
||||||
grid_fill(&wp->w_grid, row, endrow, wp->w_wincol, W_ENDCOL(wp) - 1 - n,
|
grid_fill(&wp->w_grid, row, endrow, 0, endcol - 1 - n, c2, c2, attr);
|
||||||
c2, c2, attr);
|
grid_fill(&wp->w_grid, row, endrow, endcol - 1 - n, endcol - n, c1, c2, attr);
|
||||||
grid_fill(&wp->w_grid, row, endrow, W_ENDCOL(wp) - 1 - n, W_ENDCOL(wp) - n,
|
|
||||||
c1, c2, attr);
|
|
||||||
} else {
|
} else {
|
||||||
grid_fill(&wp->w_grid, row, endrow, n, wp->w_grid.cols, c1, c2, attr);
|
grid_fill(&wp->w_grid, row, endrow, n, endcol, c1, c2, attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9224,6 +9224,55 @@ describe('float window', function()
|
|||||||
feed('<C-C>')
|
feed('<C-C>')
|
||||||
screen:expect_unchanged()
|
screen:expect_unchanged()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('with rightleft and border #22640', function()
|
||||||
|
local float_opts = {relative='editor', width=5, height=3, row=1, col=1, border='single'}
|
||||||
|
meths.open_win(meths.create_buf(false, false), true, float_opts)
|
||||||
|
command('setlocal rightleft')
|
||||||
|
feed('iabc<CR>def<Esc>')
|
||||||
|
if multigrid then
|
||||||
|
screen:expect{grid=[[
|
||||||
|
## grid 1
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[3:----------------------------------------]|
|
||||||
|
## grid 2
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
## grid 3
|
||||||
|
|
|
||||||
|
## grid 4
|
||||||
|
{5:┌─────┐}|
|
||||||
|
{5:│}{1: cba}{5:│}|
|
||||||
|
{5:│}{1: ^fed}{5:│}|
|
||||||
|
{5:│}{2: ~}{5:│}|
|
||||||
|
{5:└─────┘}|
|
||||||
|
]], float_pos={
|
||||||
|
[4] = {{id = 1001}, "NW", 1, 1, 1, true, 50};
|
||||||
|
}, win_viewport={
|
||||||
|
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||||
|
[4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 2};
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
{0:~}{5:┌─────┐}{0: }|
|
||||||
|
{0:~}{5:│}{1: cba}{5:│}{0: }|
|
||||||
|
{0:~}{5:│}{1: ^fed}{5:│}{0: }|
|
||||||
|
{0:~}{5:│}{2: ~}{5:│}{0: }|
|
||||||
|
{0:~}{5:└─────┘}{0: }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe('with ext_multigrid', function()
|
describe('with ext_multigrid', function()
|
||||||
|
@ -1812,6 +1812,22 @@ describe("'winhighlight' highlight", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('works for background color in rightleft window in vsplit #22640', function()
|
||||||
|
screen:try_resize(40, 6)
|
||||||
|
insert('aa')
|
||||||
|
command('setlocal rightleft')
|
||||||
|
command('botright vsplit')
|
||||||
|
command('setlocal winhl=Normal:Background1')
|
||||||
|
screen:expect([[
|
||||||
|
aa│{1: ^aa}|
|
||||||
|
{0: ~}│{2: ~}|
|
||||||
|
{0: ~}│{2: ~}|
|
||||||
|
{0: ~}│{2: ~}|
|
||||||
|
{4:[No Name] [+] }{3:[No Name] [+] }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it('handles undefined groups', function()
|
it('handles undefined groups', function()
|
||||||
command("set winhl=Normal:Background1")
|
command("set winhl=Normal:Background1")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
Loading…
Reference in New Issue
Block a user