[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/source_marks.c (count_c
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/source_marks.c (count_convert_u8) (register_source_mark): set the mark source position in text as an index in characters, not bytes. |
Date: |
Mon, 30 Jan 2023 16:09:38 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 95d78edb75 * tp/Texinfo/XS/parsetexi/source_marks.c (count_convert_u8)
(register_source_mark): set the mark source position in text as an index in
characters, not bytes.
95d78edb75 is described below
commit 95d78edb750984c6c35a122ba0e3ca36bb361917
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jan 30 22:09:28 2023 +0100
* tp/Texinfo/XS/parsetexi/source_marks.c (count_convert_u8)
(register_source_mark): set the mark source position in text
as an index in characters, not bytes.
---
ChangeLog | 6 ++++++
tp/Texinfo/XS/config.rpath | 2 +-
tp/Texinfo/XS/parsetexi/source_marks.c | 16 ++++++++++++++--
tp/t/19def.t | 2 +-
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 25a47eb166..554ccfaced 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/source_marks.c (count_convert_u8)
+ (register_source_mark): set the mark source position in text
+ as an index in characters, not bytes.
+
2023-01-29 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/macro.c (expand_macro_arguments): do not
diff --git a/tp/Texinfo/XS/config.rpath b/tp/Texinfo/XS/config.rpath
index 1e1ab67906..1e2595ff59 100755
--- a/tp/Texinfo/XS/config.rpath
+++ b/tp/Texinfo/XS/config.rpath
@@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2022 Free Software Foundation, Inc.
+# Copyright 1996-2023 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.c
b/tp/Texinfo/XS/parsetexi/source_marks.c
index 9e00519d0d..8d23fd727f 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.c
+++ b/tp/Texinfo/XS/parsetexi/source_marks.c
@@ -14,6 +14,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <string.h>
+#include <stdbool.h>
+#include "uniconv.h"
+#include "unistr.h"
#include "source_marks.h"
#include "tree.h"
@@ -69,6 +72,15 @@ add_source_marks (SOURCE_MARK_LIST *source_mark_list,
ELEMENT *e)
}
}
+/* count characters, not bytes. */
+size_t
+count_convert_u8 (char *text)
+{
+ uint8_t *resultbuf = u8_strconv_from_encoding (text, "UTF-8",
+ iconveh_question_mark);
+ return u8_mbsnlen (resultbuf, u8_strlen (resultbuf));
+}
+
/* ELEMENT should be the parent container.
The source mark is put in the last content if it is text
or registered in the parent container. */
@@ -117,13 +129,13 @@ register_source_mark (ELEMENT *e, SOURCE_MARK
*source_mark)
if (last_child->text.space > 0)
{
source_mark->location = source_mark_location_text;
- source_mark->position = last_child->text.end;
+ source_mark->position = count_convert_u8 (last_child->text.text);
}
}
else
{
/* add an empty element only used for source marks */
- mark_element = new_element(ET_NONE);
+ mark_element = new_element (ET_NONE);
add_to_element_contents (e, mark_element);
}
diff --git a/tp/t/19def.t b/tp/t/19def.t
index 97e4a8713b..ef08c9695b 100644
--- a/tp/t/19def.t
+++ b/tp/t/19def.t
@@ -124,7 +124,7 @@ deffn
@end deffn
'],
['end_of_lines_protected_non_ascii',
-undef, {'test_file' => 'end_of_lines_protected_non_ascii.texi', 'skip' => 'XS
counts bytes not characters' },
+undef, {'test_file' => 'end_of_lines_protected_non_ascii.texi',},# 'skip' =>
'XS counts bytes not characters' },
],
['empty_def_command',
'@deffn empty deffn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/source_marks.c (count_convert_u8) (register_source_mark): set the mark source position in text as an index in characters, not bytes.,
Patrice Dumas <=