To: vim_dev@googlegroups.com Subject: Patch 8.0.1234 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1234 Problem: MS-Windows: composing characters are not shown properly. Solution: Pass base character and composing characters to the renderer at once. (Ken Takata, closes #2206) Files: src/gui.c, src/gui_w32.c *** ../vim-8.0.1233/src/gui.c 2017-09-24 16:24:28.624560207 +0200 --- src/gui.c 2017-10-28 19:21:47.731533011 +0200 *************** *** 2429,2437 **** int cl; /* byte length of current char */ int comping; /* current char is composing */ int scol = col; /* screen column */ ! int curr_wide; /* use 'guifontwide' */ int prev_wide = FALSE; int wide_changed; /* Break the string at a composing character, it has to be drawn on * top of the previous character. */ --- 2429,2442 ---- int cl; /* byte length of current char */ int comping; /* current char is composing */ int scol = col; /* screen column */ ! int curr_wide = FALSE; /* use 'guifontwide' */ int prev_wide = FALSE; int wide_changed; + # ifdef WIN3264 + int sep_comp = FALSE; /* Don't separate composing chars. */ + # else + int sep_comp = TRUE; /* Separate composing chars. */ + # endif /* Break the string at a composing character, it has to be drawn on * top of the previous character. */ *************** *** 2441,2457 **** { c = utf_ptr2char(s + i); cn = utf_char2cells(c); - if (cn > 1 - # ifdef FEAT_XFONTSET - && fontset == NOFONTSET - # endif - && wide_font != NOFONT) - curr_wide = TRUE; - else - curr_wide = FALSE; comping = utf_iscomposing(c); if (!comping) /* count cells from non-composing chars */ cells += cn; cl = utf_ptr2len(s + i); if (cl == 0) /* hit end of string */ len = i + cl; /* len must be wrong "cannot happen" */ --- 2446,2465 ---- { c = utf_ptr2char(s + i); cn = utf_char2cells(c); comping = utf_iscomposing(c); if (!comping) /* count cells from non-composing chars */ cells += cn; + if (!comping || sep_comp) + { + if (cn > 1 + # ifdef FEAT_XFONTSET + && fontset == NOFONTSET + # endif + && wide_font != NOFONT) + curr_wide = TRUE; + else + curr_wide = FALSE; + } cl = utf_ptr2len(s + i); if (cl == 0) /* hit end of string */ len = i + cl; /* len must be wrong "cannot happen" */ *************** *** 2460,2466 **** /* Print the string so far if it's the last character or there is * a composing character. */ ! if (i + cl >= len || (comping && i > start) || wide_changed # if defined(FEAT_GUI_X11) || (cn > 1 # ifdef FEAT_XFONTSET --- 2468,2475 ---- /* Print the string so far if it's the last character or there is * a composing character. */ ! if (i + cl >= len || (comping && sep_comp && i > start) ! || wide_changed # if defined(FEAT_GUI_X11) || (cn > 1 # ifdef FEAT_XFONTSET *************** *** 2472,2478 **** # endif ) { ! if (comping || wide_changed) thislen = i - start; else thislen = i - start + cl; --- 2481,2487 ---- # endif ) { ! if ((comping && sep_comp) || wide_changed) thislen = i - start; else thislen = i - start + cl; *************** *** 2490,2496 **** cells = 0; /* Adjust to not draw a character which width is changed * against with last one. */ ! if (wide_changed && !comping) { scol -= cn; cl = 0; --- 2499,2505 ---- cells = 0; /* Adjust to not draw a character which width is changed * against with last one. */ ! if (wide_changed && !(comping && sep_comp)) { scol -= cn; cl = 0; *************** *** 2509,2515 **** # endif } /* Draw a composing char on top of the previous char. */ ! if (comping) { # if (defined(__APPLE_CC__) || defined(__MRC__)) && TARGET_API_MAC_CARBON /* Carbon ATSUI autodraws composing char over previous char */ --- 2518,2524 ---- # endif } /* Draw a composing char on top of the previous char. */ ! if (comping && sep_comp) { # if (defined(__APPLE_CC__) || defined(__MRC__)) && TARGET_API_MAC_CARBON /* Carbon ATSUI autodraws composing char over previous char */ *** ../vim-8.0.1233/src/gui_w32.c 2017-10-22 16:43:15.466595344 +0200 --- src/gui_w32.c 2017-10-28 19:21:47.735532983 +0200 *************** *** 6295,6302 **** if (enc_utf8 && n < len && unicodebuf != NULL) { ! /* Output UTF-8 characters. Caller has already separated ! * composing characters. */ int i; int wlen; /* string length in words */ int clen; /* string length in characters */ --- 6295,6302 ---- if (enc_utf8 && n < len && unicodebuf != NULL) { ! /* Output UTF-8 characters. Composing characters should be ! * handled here. */ int i; int wlen; /* string length in words */ int clen; /* string length in characters */ *************** *** 6320,6328 **** { unicodebuf[wlen++] = c; } ! cw = utf_char2cells(c); ! if (cw > 2) /* don't use 4 for unprintable char */ ! cw = 1; if (unicodepdy != NULL) { /* Use unicodepdy to make characters fit as we expect, even --- 6320,6335 ---- { unicodebuf[wlen++] = c; } ! ! if (utf_iscomposing(c)) ! cw = 0; ! else ! { ! cw = utf_char2cells(c); ! if (cw > 2) /* don't use 4 for unprintable char */ ! cw = 1; ! } ! if (unicodepdy != NULL) { /* Use unicodepdy to make characters fit as we expect, even *************** *** 6337,6343 **** unicodepdy[wlen - 1] = cw * gui.char_width; } cells += cw; ! i += utfc_ptr2len_len(text + i, len - i); ++clen; } #if defined(FEAT_DIRECTX) --- 6344,6350 ---- unicodepdy[wlen - 1] = cw * gui.char_width; } cells += cw; ! i += utf_ptr2len_len(text + i, len - i); ++clen; } #if defined(FEAT_DIRECTX) *** ../vim-8.0.1233/src/version.c 2017-10-28 18:49:57.272590807 +0200 --- src/version.c 2017-10-28 19:22:22.079298437 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1234, /**/ -- TIM: That is not an ordinary rabbit ... 'tis the most foul cruel and bad-tempered thing you ever set eyes on. ROBIN: You tit. I soiled my armour I was so scared! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///