To: vim_dev@googlegroups.com Subject: Patch 8.2.3635 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3635 Problem: GTK: composing underline does not show. Solution: Include composing character in pango call. A few more optimizations for ligatures. (Dusan Popovic, closes #9171, closes #9147) Files: src/gui_gtk_x11.c *** ../vim-8.2.3634/src/gui_gtk_x11.c 2021-11-20 20:42:25.700580223 +0000 --- src/gui_gtk_x11.c 2021-11-20 22:02:48.842449821 +0000 *************** *** 5504,5510 **** int should_need_pango = FALSE; int slen; int is_ligature; - int next_is_ligature; int is_utf8; char_u backup_ch; --- 5504,5509 ---- *************** *** 5564,5571 **** // substrings byte_sum = 0; cs = s; ! // look ahead, 0=ascii 1=unicode/ligatures ! needs_pango = ((*cs & 0x80) || gui.ligatures_map[*cs]); // split string into ascii and non-ascii (ligatures + utf-8) substrings, // print glyphs or use Pango --- 5563,5578 ---- // substrings byte_sum = 0; cs = s; ! // First char decides starting needs_pango mode, 0=ascii 1=utf8/ligatures. ! // Even if it is ligature char, two chars or more make ligature. ! // Ascii followed by utf8 is also going trough pango. ! is_utf8 = (*cs & 0x80); ! is_ligature = gui.ligatures_map[*cs] && (len > 1); ! if (is_ligature) ! is_ligature = gui.ligatures_map[*(cs + 1)]; ! if (!is_utf8 && len > 1) ! is_utf8 = (*(cs + 1) & 0x80) != 0; ! needs_pango = is_utf8 || is_ligature; // split string into ascii and non-ascii (ligatures + utf-8) substrings, // print glyphs or use Pango *************** *** 5579,5595 **** if (is_ligature && !needs_pango) { if ((slen + 1) < (len - byte_sum)) ! { ! next_is_ligature = gui.ligatures_map[*(cs + slen + 1)]; ! if (!next_is_ligature) ! is_ligature = 0; ! } else - { is_ligature = 0; - } } is_utf8 = *(cs + slen) & 0x80; should_need_pango = (is_ligature || is_utf8); if (needs_pango != should_need_pango) // mode switch break; --- 5586,5600 ---- if (is_ligature && !needs_pango) { if ((slen + 1) < (len - byte_sum)) ! is_ligature = gui.ligatures_map[*(cs + slen + 1)]; else is_ligature = 0; } is_utf8 = *(cs + slen) & 0x80; + // ascii followed by utf8 could be combining + // if so send it trough pango + if ((!is_utf8) && ((slen + 1) < (len - byte_sum))) + is_utf8 = (*(cs + slen + 1) & 0x80); should_need_pango = (is_ligature || is_utf8); if (needs_pango != should_need_pango) // mode switch break; *************** *** 5599,5605 **** { slen++; // ligature char by char } ! else { if ((*(cs + slen) & 0xC0) == 0x80) { --- 5604,5610 ---- { slen++; // ligature char by char } ! else if (is_utf8) { if ((*(cs + slen) & 0xC0) == 0x80) { *************** *** 5633,5638 **** --- 5638,5647 ---- slen++; } } + else + { + slen++; + } } else { *** ../vim-8.2.3634/src/version.c 2021-11-20 21:46:16.088614817 +0000 --- src/version.c 2021-11-20 21:59:42.839296978 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3635, /**/ -- A hamburger walks into a bar, and the bartender says: "I'm sorry, but we don't serve food here." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///