summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-03-03 03:46:26 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-03-03 03:46:26 +0000
commit9be0d6e411c5d4540438fcc8ada287a65b15fb8e (patch)
tree0474cd99f1a2b5f79352db80d10d3741a0424f01 /pango
parentf9e31856f6973a2f9ddb37cd153d413b85719187 (diff)
parent2ec635ae28261418313156e21b1eeed42d28f056 (diff)
downloadpango-9be0d6e411c5d4540438fcc8ada287a65b15fb8e.tar.gz
Merge branch 'markup-parse-fixes' into 'master'
Markup parse fixes See merge request GNOME/pango!292
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-markup.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index b74c1ad4..d0b47016 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -677,8 +677,21 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
/* The underline should go underneath the char
* we're setting as the next range_start
*/
- uline_index = md->index;
- uline_len = g_utf8_next_char (p) - p;
+ if (md->attr_list != NULL)
+ {
+ /* Add the underline indicating the accelerator */
+ PangoAttribute *attr;
+
+ attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW);
+
+ uline_index = md->index;
+ uline_len = g_utf8_next_char (p) - p;
+
+ attr->start_index = uline_index;
+ attr->end_index = uline_index + uline_len;
+
+ pango_attr_list_change (md->attr_list, attr);
+ }
/* set next range_start to include this char */
range_start = p;
@@ -693,35 +706,12 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
}
p = g_utf8_next_char (p);
- }
-
- if (range_end)
- {
- g_string_append_len (md->text,
- range_start,
- range_end - range_start);
- md->index += range_end - range_start;
- }
- else
- {
- g_string_append_len (md->text,
- range_start,
- end - range_start);
- md->index += end - range_start;
- }
-
- if (md->attr_list != NULL && uline_index >= 0)
- {
- /* Add the underline indicating the accelerator */
- PangoAttribute *attr;
-
- attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW);
-
- attr->start_index = uline_index;
- attr->end_index = uline_index + uline_len;
+ }
- pango_attr_list_change (md->attr_list, attr);
- }
+ g_string_append_len (md->text,
+ range_start,
+ end - range_start);
+ md->index += end - range_start;
}
}