forked from aniani/vim
patch 8.2.3635: GTK: composing underline does not show
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)
This commit is contained in:
committed by
Bram Moolenaar
parent
d604d78e7b
commit
3c19b50500
@@ -5504,7 +5504,6 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
|
|||||||
int should_need_pango = FALSE;
|
int should_need_pango = FALSE;
|
||||||
int slen;
|
int slen;
|
||||||
int is_ligature;
|
int is_ligature;
|
||||||
int next_is_ligature;
|
|
||||||
int is_utf8;
|
int is_utf8;
|
||||||
char_u backup_ch;
|
char_u backup_ch;
|
||||||
|
|
||||||
@@ -5564,8 +5563,16 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
|
|||||||
// substrings
|
// substrings
|
||||||
byte_sum = 0;
|
byte_sum = 0;
|
||||||
cs = s;
|
cs = s;
|
||||||
// look ahead, 0=ascii 1=unicode/ligatures
|
// First char decides starting needs_pango mode, 0=ascii 1=utf8/ligatures.
|
||||||
needs_pango = ((*cs & 0x80) || gui.ligatures_map[*cs]);
|
// 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,
|
// split string into ascii and non-ascii (ligatures + utf-8) substrings,
|
||||||
// print glyphs or use Pango
|
// print glyphs or use Pango
|
||||||
@@ -5579,17 +5586,15 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
|
|||||||
if (is_ligature && !needs_pango)
|
if (is_ligature && !needs_pango)
|
||||||
{
|
{
|
||||||
if ((slen + 1) < (len - byte_sum))
|
if ((slen + 1) < (len - byte_sum))
|
||||||
{
|
is_ligature = gui.ligatures_map[*(cs + slen + 1)];
|
||||||
next_is_ligature = gui.ligatures_map[*(cs + slen + 1)];
|
|
||||||
if (!next_is_ligature)
|
|
||||||
is_ligature = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
is_ligature = 0;
|
is_ligature = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
is_utf8 = *(cs + slen) & 0x80;
|
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);
|
should_need_pango = (is_ligature || is_utf8);
|
||||||
if (needs_pango != should_need_pango) // mode switch
|
if (needs_pango != should_need_pango) // mode switch
|
||||||
break;
|
break;
|
||||||
@@ -5599,7 +5604,7 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
|
|||||||
{
|
{
|
||||||
slen++; // ligature char by char
|
slen++; // ligature char by char
|
||||||
}
|
}
|
||||||
else
|
else if (is_utf8)
|
||||||
{
|
{
|
||||||
if ((*(cs + slen) & 0xC0) == 0x80)
|
if ((*(cs + slen) & 0xC0) == 0x80)
|
||||||
{
|
{
|
||||||
@@ -5633,6 +5638,10 @@ gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
|
|||||||
slen++;
|
slen++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
slen++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3635,
|
||||||
/**/
|
/**/
|
||||||
3634,
|
3634,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user