diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-18 12:08:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-18 12:08:18 +0800 |
commit | 71ad771ea4b77119abcff706b9666fa534963819 (patch) | |
tree | 358360822fe73de94739fccd066648ce4a02e2e1 | |
parent | c54682f75aca8785a4ee9e32b8dc44a1012c3e39 (diff) | |
download | rneovim-71ad771ea4b77119abcff706b9666fa534963819.tar.gz rneovim-71ad771ea4b77119abcff706b9666fa534963819.tar.bz2 rneovim-71ad771ea4b77119abcff706b9666fa534963819.zip |
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
-rw-r--r-- | src/nvim/ui_compositor.c | 2 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c index 59e9f71a69..e9b23d1298 100644 --- a/src/nvim/ui_compositor.c +++ b/src/nvim/ui_compositor.c @@ -402,7 +402,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag if (col == endcol - 1) { skipend = 0; } - } else if (n > 1 && linebuf[col - startcol + 1][0] == NUL) { + } else if (col == startcol && n > 1 && linebuf[1][0] == NUL) { skipstart = 0; } diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 46c2127c30..c2bcac2449 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -8377,6 +8377,7 @@ describe('float window', function() # TODO: 测试字典信息的准确性 # FIXME: 测试字典信息的准确性]]) 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'}) if multigrid then screen:expect{grid=[[ @@ -8397,15 +8398,15 @@ describe('float window', function() {0:~ }| ## grid 3 | - ## grid 4 - {1: }| - {1: }| + ## grid 5 + {1:口 }| + {1:口 }| {1: }| - ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }} + ]], float_pos={ [5] = { { id = 1002 }, "NW", 1, 0, 11, true } }} else screen:expect([[ - # TODO: 测 {1: }信息的准确性 | - # FIXME: 测{1: } 信息的准确^性 | + # TODO: 测 {1:口 }信息的准确性 | + # FIXME: 测{1:口 } 信息的准确^性 | {0:~ }{1: }{0: }| {0:~ }| {0:~ }| |