Skip to content

Commit fae8ed1

Browse files
committed
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)
1 parent a703aae commit fae8ed1

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/screen.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8317,15 +8317,29 @@ screen_char(unsigned off, int row, int col)
83178317
{
83188318
char_u buf[MB_MAXBYTES + 1];
83198319

8320-
/* Convert UTF-8 character to bytes and write it. */
8321-
8322-
buf[utfc_char2bytes(off, buf)] = NUL;
8323-
8324-
out_str(buf);
83258320
if (utf_ambiguous_width(ScreenLinesUC[off]))
8321+
{
8322+
if (*p_ambw == 'd'
8323+
# ifdef FEAT_GUI
8324+
&& !gui.in_use
8325+
# endif
8326+
)
8327+
{
8328+
/* Clear the two screen cells. If the character is actually
8329+
* single width it won't change the second cell. */
8330+
out_str((char_u *)" ");
8331+
term_windgoto(row, col);
8332+
}
8333+
/* not sure where the cursor is after drawing the ambiguous width
8334+
* character */
83268335
screen_cur_col = 9999;
8336+
}
83278337
else if (utf_char2cells(ScreenLinesUC[off]) > 1)
83288338
++screen_cur_col;
8339+
8340+
/* Convert the UTF-8 character to bytes and write it. */
8341+
buf[utfc_char2bytes(off, buf)] = NUL;
8342+
out_str(buf);
83298343
}
83308344
else
83318345
#endif

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1388,
774776
/**/
775777
1387,
776778
/**/

0 commit comments

Comments
 (0)