# HG changeset patch # User Christian Brabandt # Date 1513114205 -3600 # Node ID 27934188d7b586e30ad7f72067a8a22e3f1e1f11 # Parent 999318b2de6823d7571b1a07a7dd3c051ce8a93c patch 8.0.1388: char not overwritten with ambiguous width char commit https://github.com/vim/vim/commit/fae8ed1fc8c06b28528d726e8440dfc66852bca8 Author: Bram Moolenaar Date: Tue Dec 12 22:29:30 2017 +0100 patch 8.0.1388: char not overwritten with ambiguous width char Problem: Char not overwritten with ambiguous width char, if the ambiguous char is single width but we reserve double-width space. Solution: First clear the screen cells. (Ozaki Kiichi, closes #2436) diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -8317,15 +8317,29 @@ screen_char(unsigned off, int row, int c { char_u buf[MB_MAXBYTES + 1]; - /* Convert UTF-8 character to bytes and write it. */ - - buf[utfc_char2bytes(off, buf)] = NUL; - - out_str(buf); if (utf_ambiguous_width(ScreenLinesUC[off])) + { + if (*p_ambw == 'd' +# ifdef FEAT_GUI + && !gui.in_use +# endif + ) + { + /* Clear the two screen cells. If the character is actually + * single width it won't change the second cell. */ + out_str((char_u *)" "); + term_windgoto(row, col); + } + /* not sure where the cursor is after drawing the ambiguous width + * character */ screen_cur_col = 9999; + } else if (utf_char2cells(ScreenLinesUC[off]) > 1) ++screen_cur_col; + + /* Convert the UTF-8 character to bytes and write it. */ + buf[utfc_char2bytes(off, buf)] = NUL; + out_str(buf); } else #endif diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1388, +/**/ 1387, /**/ 1386,