diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-08-15 19:40:45 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-08-15 19:41:40 -0400 |
commit | 0328707ed085cc15b381ad6e8700aa630f20f5a6 (patch) | |
tree | fa2506cddd53c7922eda4bd5815e6b928af2a34e /pango/break.c | |
parent | 287d6ecd5f1a8683e2163bcde4bf36815082534f (diff) | |
download | pango-0328707ed085cc15b381ad6e8700aa630f20f5a6.tar.gz |
Fix backspace-deletes-character for Emoji
We want to delete the entire cluster if it is an Emoji.
To do so, look at prev_GB_type to find Emoji.
This fixes backspacing for sequences like
"man health worker" or "family: man, woman, boy, girl".
Diffstat (limited to 'pango/break.c')
-rw-r--r-- | pango/break.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pango/break.c b/pango/break.c index ccf13941..f1bfb999 100644 --- a/pango/break.c +++ b/pango/break.c @@ -861,15 +861,23 @@ pango_default_break (const gchar *text, else is_grapheme_boundary = TRUE; /* Rule GB999 */ - prev_GB_type = GB_type; - attrs[i].is_cursor_position = is_grapheme_boundary; /* If this is a grapheme boundary, we have to decide if backspace * deletes a character or the whole grapheme cluster */ if (is_grapheme_boundary) - attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character); + { + if (prev_GB_type == GB_E_Base || + prev_GB_type == GB_E_Base_GAZ || + prev_GB_type == GB_Glue_After_Zwj || + prev_GB_type == GB_Extend) + attrs[i].backspace_deletes_character = FALSE; + else + attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character); + } else attrs[i].backspace_deletes_character = FALSE; + + prev_GB_type = GB_type; } /* ---- UAX#29 Word Boundaries ---- */ |