aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-12-25 13:36:37 +0100
committerGitHub <noreply@github.com>2021-12-25 13:36:37 +0100
commit3e81c1f9b5e37a3e62dfbf2938331993de064231 (patch)
tree25e58288ca214cc1b18ec68f8caa73d593b1264b /src/nvim/screen.c
parentd2f62b3164353b61904b28348fca8a7f3f41f202 (diff)
parent4f70b31f7aee3a34c8d6b5c63184f97b0c1dcbce (diff)
downloadrneovim-3e81c1f9b5e37a3e62dfbf2938331993de064231.tar.gz
rneovim-3e81c1f9b5e37a3e62dfbf2938331993de064231.tar.bz2
rneovim-3e81c1f9b5e37a3e62dfbf2938331993de064231.zip
Merge pull request #16762 from zeertzjq/grid-truncate-pum-double-width
Truncate double-width character at the end of popup menu correctly
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index a938a3b062..e62e3ca7bc 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5933,6 +5933,8 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
// Only 1 cell left, but character requires 2 cells:
// display a '>' in the last column to avoid wrapping. */
c = '>';
+ u8c = '>';
+ u8cc[0] = 0;
mbyte_cells = 1;
}
@@ -5963,6 +5965,13 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
clear_next_cell = true;
}
+ // When at the start of the text and overwriting the right half of a
+ // two-cell character in the same grid, truncate that into a '>'.
+ if (ptr == text && col > 0 && grid->chars[off][0] == 0) {
+ grid->chars[off - 1][0] = '>';
+ grid->chars[off - 1][1] = 0;
+ }
+
schar_copy(grid->chars[off], buf);
grid->attrs[off] = attr;
if (mbyte_cells == 2) {