To: vim_dev@googlegroups.com Subject: Patch 8.0.1388 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1388 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) Files: src/screen.c *** ../vim-8.0.1387/src/screen.c 2017-12-05 20:31:02.524899040 +0100 --- src/screen.c 2017-12-12 22:28:34.368851896 +0100 *************** *** 8317,8331 **** { 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])) screen_cur_col = 9999; else if (utf_char2cells(ScreenLinesUC[off]) > 1) ++screen_cur_col; } else #endif --- 8317,8345 ---- { char_u buf[MB_MAXBYTES + 1]; 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 *** ../vim-8.0.1387/src/version.c 2017-12-11 22:55:08.556254393 +0100 --- src/version.c 2017-12-12 22:25:52.837909772 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1388, /**/ -- From "know your smileys": [:-) Frankenstein's monster /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///