[gnome-builder/wip/slaf/xml-pack: 46/56] xml-pack: fix errors in sax nodes coordinates
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/slaf/xml-pack: 46/56] xml-pack: fix errors in sax nodes coordinates
- Date: Thu, 13 Jul 2017 12:22:53 +0000 (UTC)
commit 33cecf55bb293f274eb82bc20163f2e17da9351f
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Jul 9 16:00:58 2017 +0200
xml-pack: fix errors in sax nodes coordinates
plugins/xml-pack/ide-xml-sax.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-sax.c b/plugins/xml-pack/ide-xml-sax.c
index 728cc8a..1b9e1d6 100644
--- a/plugins/xml-pack/ide-xml-sax.c
+++ b/plugins/xml-pack/ide-xml-sax.c
@@ -220,15 +220,28 @@ get_tag_location (IdeXmlSax *self,
ch = g_utf8_get_char (current);
if (ch != '>')
{
+ /* End element case */
+ if (current > base && g_utf8_get_char (current - 1) == '>')
+ {
+ --current;
+ size_offset = 0;
+ }
+ /* Auto-closed start element case */
+ else if (ch == '/' && g_utf8_get_char (current + 1) == '>')
+ {
+ ++current;
+ size_offset = 2;
+ }
/* Not properly closed tag */
- if (ch == '<' || ch == 0)
+ else
{
ch = g_utf8_get_char (--current);
if (ch == '<')
{
/* Empty node */
*line = *end_line = end_line_number;
- *line_offset = *end_line_offset = xmlSAX2GetColumnNumber (self->context);
+ *line_offset = *end_line_offset = xmlSAX2GetColumnNumber (self->context) - 1;
+ *size = 1;
return;
}
else
@@ -251,18 +264,6 @@ get_tag_location (IdeXmlSax *self,
goto next;
}
}
- /* Auto-closed start element case */
- else if (ch == '/' && g_utf8_get_char (current + 1) == '>')
- {
- ++current;
- size_offset = 2;
- }
- /* End element case */
- else if (current > base && g_utf8_get_char (current - 1) == '>')
- {
- --current;
- size_offset = 0;
- }
}
end_current = current;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]