commit bc814cfb2cfa6ce2fa599cca2cb8166b44b962a6
parent d4f2b9050dc6028871eb4dbfb6500cd7b5c07890
Author: Skoh <101289702+SkohTV@users.noreply.github.com>
Date: Wed, 23 Apr 2025 14:27:21 +0200
fix(winblend): treat braille blank (\u2800) as whitespace #32741
Problem:
'winblend' does not display text behind blank unicode characters other than 0x20 ascii space.
Solution:
In ui_compositor.c -> compose_line() check for either 0x20 or 0x80A0E2 (utf8 \u2800).
Diffstat:
2 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
@@ -422,10 +422,12 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlag
for (int i = col - (int)startcol; i < until - startcol; i += width) {
width = 1;
// negative space
- bool thru = linebuf[i] == schar_from_ascii(' ') && bg_line[i] != NUL;
+ bool thru = (linebuf[i] == schar_from_ascii(' ')
+ || linebuf[i] == schar_from_char(L'\u2800')) && bg_line[i] != NUL;
if (i + 1 < endcol - startcol && bg_line[i + 1] == NUL) {
width = 2;
- thru &= linebuf[i + 1] == schar_from_ascii(' ');
+ thru &= (linebuf[i + 1] == schar_from_ascii(' ')
+ || linebuf[i + 1] == schar_from_char(L'\u2800'));
}
attrbuf[i] = (sattr_T)hl_blend_attrs(bg_attrs[i], attrbuf[i], &thru);
if (width == 2) {
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
@@ -7947,7 +7947,8 @@ describe('float window', function()
qui officia deserunt mollit anim id est
laborum.]])
local buf = api.nvim_create_buf(false,false)
- api.nvim_buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"})
+ local test_data = {"test", "", "popup text"}
+ api.nvim_buf_set_lines(buf, 0, -1, true, test_data)
local win = api.nvim_open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5})
if multigrid then
screen:expect{grid=[[
@@ -8020,6 +8021,45 @@ describe('float window', function()
]])
end
+ -- Test for \u2800 (braille blank unicode character)
+ local braille_blank = "\226\160\128"
+ api.nvim_buf_set_lines(buf, 0, -1, true, {"test" .. braille_blank, "", "popup"..braille_blank.." text"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|*8
+ [3:--------------------------------------------------]|
+ ## grid 2
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ ## grid 3
+ |
+ ## grid 4
+ {9:test]] .. braille_blank .. [[ }|
+ {9: }|
+ {9:popup]] .. braille_blank .. [[ text }|
+ ]], float_pos={[4] = {1001, "NW", 1, 2, 5, true, 50, 1, 2, 5}}, unchanged=true}
+ else
+ screen:expect([[
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea co{2:test}{3:o consequat}. Duis aute irure dolor in |
+ repre{3:henderit in vol}uptate velit esse cillum |
+ dolor{2:popup}{3:fugi}{2:text}{3:ul}la pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ |
+ ]])
+ end
+ api.nvim_buf_set_lines(buf, 0, -1, true, test_data)
+
-- Check that 'winblend' works with NormalNC highlight
api.nvim_set_option_value('winhighlight', 'NormalNC:Visual', {win = win})
if multigrid then