fix(ui_compositor): only reset skipstart at first column (#24776)

Problem:    A double-width char in a floating window causes an extra
            space to be drawn to the left of its boundary.
Solution:   Only reset skipstart at the first column.

Fix #24775
This commit is contained in:
zeertzjq 2023-08-18 12:08:18 +08:00 committed by GitHub
parent c54682f75a
commit 71ad771ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -402,7 +402,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag
if (col == endcol - 1) { if (col == endcol - 1) {
skipend = 0; skipend = 0;
} }
} else if (n > 1 && linebuf[col - startcol + 1][0] == NUL) { } else if (col == startcol && n > 1 && linebuf[1][0] == NUL) {
skipstart = 0; skipstart = 0;
} }

View File

@ -8377,6 +8377,7 @@ describe('float window', function()
# TODO: # TODO:
# FIXME: ]]) # FIXME: ]])
local buf = meths.create_buf(false,false) local buf = meths.create_buf(false,false)
meths.buf_set_lines(buf, 0, -1, true, {'', ''})
local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'}) local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'})
if multigrid then if multigrid then
screen:expect{grid=[[ screen:expect{grid=[[
@ -8397,15 +8398,15 @@ describe('float window', function()
{0:~ }| {0:~ }|
## grid 3 ## grid 3
| |
## grid 4 ## grid 5
{1: }|
{1: }|
{1: }| {1: }|
{1: }| ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 0, 11, true } }}
{1: }|
]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }}
else else
screen:expect([[ screen:expect([[
# TODO: {1: } | # TODO: {1: } |
# FIXME: {1: } ^ | # FIXME: {1: } ^ |
{0:~ }{1: }{0: }| {0:~ }{1: }{0: }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|