]> granicus.if.org Git - vim/commitdiff
patch 8.0.1388: char not overwritten with ambiguous width char v8.0.1388
authorBram Moolenaar <Bram@vim.org>
Tue, 12 Dec 2017 21:29:30 +0000 (22:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 12 Dec 2017 21:29:30 +0000 (22:29 +0100)
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)

src/screen.c
src/version.c

index a74f750711d771fd7347fe7b9902028c5d93eca0..090a4b3dd6f6b3a51d619e60708d96a716c50841 100644 (file)
@@ -8317,15 +8317,29 @@ screen_char(unsigned off, int row, int col)
     {
        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
index 2f9957af8d0c31e4f816d97d7ae6b54893847a74..b805fd7c0b972d57a908872bd5f4cb10418550c4 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1388,
 /**/
     1387,
 /**/