diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-07-13 16:09:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 16:09:25 +0200 |
commit | 6f944d36cf8a89f128b638a6ea6b412d62f309bf (patch) | |
tree | 0361bbddb986127fc89ad391e89c26b60aa20fc1 /src | |
parent | 4013f670537246826dae738d5cb86fd075f59f82 (diff) | |
parent | cb9e0a051f7ed36d7f03819f9d71b3000164b826 (diff) | |
download | rneovim-6f944d36cf8a89f128b638a6ea6b412d62f309bf.tar.gz rneovim-6f944d36cf8a89f128b638a6ea6b412d62f309bf.tar.bz2 rneovim-6f944d36cf8a89f128b638a6ea6b412d62f309bf.zip |
Merge pull request #10492 from bfredl/blend_doublewidth
floats: fix 'winblend' on top of doublewidth chars.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/highlight_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/ui_compositor.c | 17 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h index 60f571ff0f..25d859c55d 100644 --- a/src/nvim/highlight_defs.h +++ b/src/nvim/highlight_defs.h @@ -36,6 +36,7 @@ typedef struct attr_entry { .rgb_sp_color = -1, \ .cterm_fg_color = 0, \ .cterm_bg_color = 0, \ + .hl_blend = -1, \ } /// Values for index in highlight_attr[]. diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c index 858ffbe5bc..d0b21ae591 100644 --- a/src/nvim/ui_compositor.c +++ b/src/nvim/ui_compositor.c @@ -344,11 +344,22 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, // 'pumblend' and 'winblend' if (grid->blending) { - for (int i = col-(int)startcol; i < until-startcol; i++) { - bool thru = strequal((char *)linebuf[i], " "); // negative space + int width; + for (int i = col-(int)startcol; i < until-startcol; i += width) { + width = 1; + // negative space + bool thru = strequal((char *)linebuf[i], " ") && bg_line[i][0] != NUL; + if (i+1 < endcol-startcol && bg_line[i+1][0] == NUL) { + width = 2; + thru &= strequal((char *)linebuf[i+1], " "); + } attrbuf[i] = (sattr_T)hl_blend_attrs(bg_attrs[i], attrbuf[i], &thru); + if (width == 2) { + attrbuf[i+1] = (sattr_T)hl_blend_attrs(bg_attrs[i+1], + attrbuf[i+1], &thru); + } if (thru) { - memcpy(linebuf[i], bg_line[i], sizeof(linebuf[i])); + memcpy(linebuf[i], bg_line[i], (size_t)width * sizeof(linebuf[i])); } } } |