texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next), tp/T


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next), tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): use Texinfo::Convert::Unicode::string_width to get the word width in perl. Re-apply Gavin change in xspara.c to use wcwidth to determine the width of characters.
Date: Thu, 18 Aug 2022 12:41:52 -0400

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 3ab17c8995 * tp/Texinfo/XS/xspara.c (xspara__add_next), 
tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): use 
Texinfo::Convert::Unicode::string_width to get the word width in perl.  
Re-apply Gavin change in xspara.c to use wcwidth to determine the width of 
characters.
3ab17c8995 is described below

commit 3ab17c899507ac93683c2ae990f85150051600a4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Aug 18 18:41:42 2022 +0200

    * tp/Texinfo/XS/xspara.c (xspara__add_next),
    tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): use
    Texinfo::Convert::Unicode::string_width to get the word width in
    perl.  Re-apply Gavin change in xspara.c to use wcwidth to determine
    the width of characters.
---
 ChangeLog                                                    |  8 ++++++++
 tp/Texinfo/Convert/ParagraphNonXS.pm                         | 10 +++-------
 tp/Texinfo/XS/xspara.c                                       |  6 +-----
 tp/t/results/converters_tests/empty_accent.pl                |  3 +--
 tp/tests/layout/res_parser/formatting_info/formatting.info   | 12 ++++++------
 .../layout/res_parser/formatting_plaintext/formatting.txt    |  8 ++++----
 6 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6e8460e2e0..a5601bbf7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-08-17  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/xspara.c (xspara__add_next),
+       tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): use
+       Texinfo::Convert::Unicode::string_width to get the word width in
+       perl.  Re-apply Gavin change in xspara.c to use wcwidth to determine
+       the width of characters.
+
 2022-08-18  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.tex (@afivepaper): Adjust horizontal location so as
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm 
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index b8497d959c..8a0ce1fb85 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -29,6 +29,7 @@ use strict;
 use if $] >= 5.014, re => '/a';  # ASCII-only character classes in regexes
 
 use Unicode::EastAsianWidth;
+use Texinfo::Convert::Unicode;
 use Carp qw(cluck);
 
 # initialize a paragraph object.
@@ -222,13 +223,8 @@ sub _add_next($;$$$)
       $paragraph->{'word'} = undef;
       $paragraph->{'last_char'} = undef;
     } else {
-      my $word2;
-      $word2 = $word;
-      $word2 =~ s/[\177]//g;
-      $paragraph->{'word_counter'} += length($word2);
-      # We don't count DEL bytes here for INFO_SPECIAL_CHARS_QUOTE.  We 
-      # shouldn't count combining characters for accents either: see the
-      # t/converters_tests.t (at_commands_in_refs_utf8) test.
+      $paragraph->{'word_counter'}
+        += Texinfo::Convert::Unicode::string_width($word);
     }
     if ($paragraph->{'DEBUG'}) {
       my $para_word = 'UNDEF';;
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index a8172bdab5..93924a623c 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -721,12 +721,8 @@ xspara__add_next (TEXT *result, char *word, int word_len, 
int transparent)
           left -= char_len;
 
           columns = wcwidth (w);
-          /* Not correct but this matches the results from
-             the Perl code. */
-          if (columns == 0)
-            columns = 1;
           if (columns > 0)
-            len++;
+            len += columns;
 
           p += char_len;
         }
diff --git a/tp/t/results/converters_tests/empty_accent.pl 
b/tp/t/results/converters_tests/empty_accent.pl
index 20ef634768..7f8fa4f410 100644
--- a/tp/t/results/converters_tests/empty_accent.pl
+++ b/tp/t/results/converters_tests/empty_accent.pl
@@ -64,8 +64,7 @@ $result_floats{'empty_accent'} = {};
 
 
 
-$result_converted{'plaintext'}->{'empty_accent'} = '̀
-';
+$result_converted{'plaintext'}->{'empty_accent'} = '̀';
 
 
 $result_converted{'html_text'}->{'empty_accent'} = '<p>&#768;
diff --git a/tp/tests/layout/res_parser/formatting_info/formatting.info 
b/tp/tests/layout/res_parser/formatting_info/formatting.info
index 970d0b8aad..415ef06dd8 100644
--- a/tp/tests/layout/res_parser/formatting_info/formatting.info
+++ b/tp/tests/layout/res_parser/formatting_info/formatting.info
@@ -62,8 +62,8 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 
a a a a
 '@H{a}' a̋ '@H{--a}' -a̋ '@dotaccent{a}' ȧ '@dotaccent{--a}' -ȧ
 '@ringaccent{a}' å '@ringaccent{--a}' -å '@tieaccent{a}' a͡
 '@tieaccent{--a}' -a͡ '@u{a}' ă '@u{--a}' -ă '@ubaraccent{a}' a̲
-'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}'
-ǎ '@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
+'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}' ǎ
+'@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
 'a@sup{h}@sub{l}' a^{h}_{l} '@footnote{in footnote}' (1) '@footnote{in
 footnote2}' (2)
 
@@ -772,8 +772,8 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 
a a a a a
 '@H{a}' a̋ '@H{--a}' -a̋ '@dotaccent{a}' ȧ '@dotaccent{--a}' -ȧ
 '@ringaccent{a}' å '@ringaccent{--a}' -å '@tieaccent{a}' a͡
 '@tieaccent{--a}' -a͡ '@u{a}' ă '@u{--a}' -ă '@ubaraccent{a}' a̲
-'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}'
-ǎ '@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
+'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}' ǎ
+'@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
 'a@sup{h}@sub{l}' a^{h}_{l} '@footnote{in footnote}' (1) '@footnote{in
 footnote2}' (2)
 
@@ -1439,8 +1439,8 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 
a a a a a a
 '@H{a}' a̋ '@H{--a}' -a̋ '@dotaccent{a}' ȧ '@dotaccent{--a}' -ȧ
 '@ringaccent{a}' å '@ringaccent{--a}' -å '@tieaccent{a}' a͡
 '@tieaccent{--a}' -a͡ '@u{a}' ă '@u{--a}' -ă '@ubaraccent{a}' a̲
-'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}'
-ǎ '@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
+'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}' ǎ
+'@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
 'a@sup{h}@sub{l}' a^{h}_{l} '@footnote{in footnote}' (3) '@footnote{in
 footnote2}' (4)
 
diff --git a/tp/tests/layout/res_parser/formatting_plaintext/formatting.txt 
b/tp/tests/layout/res_parser/formatting_plaintext/formatting.txt
index c2dba8aa34..c646944ff4 100644
--- a/tp/tests/layout/res_parser/formatting_plaintext/formatting.txt
+++ b/tp/tests/layout/res_parser/formatting_plaintext/formatting.txt
@@ -75,8 +75,8 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 
a a a a
 '@H{a}' a̋ '@H{--a}' -a̋ '@dotaccent{a}' ȧ '@dotaccent{--a}' -ȧ
 '@ringaccent{a}' å '@ringaccent{--a}' -å '@tieaccent{a}' a͡
 '@tieaccent{--a}' -a͡ '@u{a}' ă '@u{--a}' -ă '@ubaraccent{a}' a̲
-'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}'
-ǎ '@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
+'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}' ǎ
+'@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
 'a@sup{h}@sub{l}' a^{h}_{l} '@footnote{in footnote}' (1) '@footnote{in
 footnote2}' (2)
 
@@ -742,8 +742,8 @@ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 
a a a a a
 '@H{a}' a̋ '@H{--a}' -a̋ '@dotaccent{a}' ȧ '@dotaccent{--a}' -ȧ
 '@ringaccent{a}' å '@ringaccent{--a}' -å '@tieaccent{a}' a͡
 '@tieaccent{--a}' -a͡ '@u{a}' ă '@u{--a}' -ă '@ubaraccent{a}' a̲
-'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}'
-ǎ '@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
+'@ubaraccent{--a}' -a̲ '@udotaccent{a}' ạ '@udotaccent{--a}' -ạ '@v{a}' ǎ
+'@v{--a}' -ǎ '@,{c}' ç '@,{--c}' -ç '@ogonek{a}' ą '@ogonek{--a}' -ą
 'a@sup{h}@sub{l}' a^{h}_{l} '@footnote{in footnote}' (3) '@footnote{in
 footnote2}' (4)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]