[gnome-builder] xml-pack: fix searching tag limits
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] xml-pack: fix searching tag limits
- Date: Wed, 19 Jul 2017 10:14:34 +0000 (UTC)
commit 8f74bcfdb0caee48543b498a1dc1834390c1fea5
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Jul 19 11:22:10 2017 +0200
xml-pack: fix searching tag limits
plugins/xml-pack/ide-xml-sax.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-sax.c b/plugins/xml-pack/ide-xml-sax.c
index ba2564f..a0f445c 100644
--- a/plugins/xml-pack/ide-xml-sax.c
+++ b/plugins/xml-pack/ide-xml-sax.c
@@ -194,7 +194,7 @@ get_tag_location (IdeXmlSax *self,
const gchar *current;
const gchar *end_current;
const gchar *line_start;
- const gchar *end_line_start = NULL;
+ const gchar *end_line_start;
gint start_line_number;
gint end_line_number;
gint size_offset = 1;
@@ -278,6 +278,7 @@ get_tag_location (IdeXmlSax *self,
}
next:
+ /* Search back the tag start and adjust the start and end line */
while (current > base)
{
ch = g_utf8_get_char (current);
@@ -297,6 +298,7 @@ next:
current = g_utf8_prev_char (current);
}
+ /* Search back the tag start offset */
line_start = current;
while (line_start > base)
{
@@ -305,7 +307,10 @@ next:
{
++line_start;
if (!end_line_found )
- end_line_start = line_start;
+ {
+ end_line_start = line_start;
+ end_line_found = TRUE;
+ }
break;
}
@@ -313,7 +318,8 @@ next:
line_start = g_utf8_prev_char (line_start);
}
- g_assert (end_line_start != NULL);
+ if (!end_line_found)
+ end_line_start = line_start;
*line = start_line_number;
*line_offset = (current - line_start) + 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]