texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Remove special treatment of \r in paragraph forma


From: Gavin D. Smith
Subject: branch master updated: Remove special treatment of \r in paragraph formatter
Date: Mon, 18 Apr 2022 15:18:15 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new f4d2e56486 Remove special treatment of \r in paragraph formatter
f4d2e56486 is described below

commit f4d2e5648673260ed78c0f675f95f924459aa525
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Apr 18 20:18:05 2022 +0100

    Remove special treatment of \r in paragraph formatter
    
    * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text),
    * tp/Texinfo/XS/xspara.c (xspara_add_text)
    <space not at end of sentence>: Remove special handling of
    carriage return.  The code is somewhat hard to follow and it
    should be unlikely that a carriage return makes it to this code.
---
 ChangeLog                                          | 10 +++++++++
 tp/Texinfo/Convert/ParagraphNonXS.pm               |  5 ++---
 tp/Texinfo/XS/xspara.c                             |  4 ++--
 tp/t/results/sectioning/special_spaces_in_nodes.pl | 24 +++++++++++-----------
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 85b8e28079..37b5bb96bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-04-18  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Remove special treatment of \r in paragraph formatter
+
+       * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text),
+       * tp/Texinfo/XS/xspara.c (xspara_add_text)
+       <space not at end of sentence>: Remove special handling of
+       carriage return.  The code is somewhat hard to follow and it
+       should be unlikely that a carriage return makes it to this code.
+
 2022-04-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text): consider \r
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm 
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index 523d92515b..7f82615479 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -366,16 +366,15 @@ sub add_text($$)
             # Only save the first space
             if ($paragraph->{'unfilled'}
                 or length($paragraph->{'space'}) < 1) {
-              if ($spaces =~ /[\n\r]/) {
+              if ($spaces =~ /\n/) {
                 if (!$paragraph->{'unfilled'}) {
                   $paragraph->{'space'} = ' ';
-                } elsif ($spaces =~ /\n/) {
+                } else {
                   $result .= _add_pending_word ($paragraph);
                   $result .= _end_line ($paragraph);
                 }
               } else {
                 if (!$paragraph->{'unfilled'}) {
-                  $spaces =~ s/\r/ /g;
                   $paragraph->{'space'} .= substr ($spaces, 0, 1);
                 } else {
                   $paragraph->{'space'} .= $spaces;
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 09980035cc..c04ea77e52 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -920,14 +920,14 @@ xspara_add_text (char *text)
                       /* Only save the first space. */
                       if (state.unfilled || state.space_counter < 1)
                         {
-                          if (*p == '\n' || *p == '\r')
+                          if (*p == '\n')
                             {
                               if (!state.unfilled)
                                 {
                                   text_append_n (&state.space, " ", 1);
                                   state.space_counter++;
                                 }
-                              else if (*p == '\n')
+                              else
                                 {
                                   xspara__add_pending_word (&result, 0);
                                   xspara__end_line ();
diff --git a/tp/t/results/sectioning/special_spaces_in_nodes.pl 
b/tp/t/results/sectioning/special_spaces_in_nodes.pl
index 8d7baa8620..6ff98643fc 100644
--- a/tp/t/results/sectioning/special_spaces_in_nodes.pl
+++ b/tp/t/results/sectioning/special_spaces_in_nodes.pl
@@ -1607,7 +1607,7 @@ File: ,  Node: EN QUAD| | EM QUAD| | EN SPACE| |,  Up: 
Top 
 * Menu:
 
 * CHARACTER TABULATION|        | FORM FEED|| LINE TABULATION||::
-* CARRIAGE RETURN||::
+* CARRIAGE RETURN|
|::
 * NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |::
 * MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |::
 * THREE-PER-EM SPACE| | FOUR-PER-EM SPACE| | SIX-PER-EM SPACE| |::
@@ -1616,13 +1616,13 @@ File: ,  Node: EN QUAD| | EM QUAD| | EN SPACE| |,  Up: 
Top 
 * NARROW NO-BREAK SPACE| | MEDIUM MATHEMATICAL SPACE| | IDEOGRAPHIC SPACE| |::
 
 
-File: ,  Node: CHARACTER TABULATION|   | FORM FEED|| LINE TABULATION||,  
Next: CARRIAGE RETURN| |,  Up: EN QUAD| | EM QUAD| | EN SPACE| |
+File: ,  Node: CHARACTER TABULATION|   | FORM FEED|| LINE TABULATION||,  
Next: CARRIAGE RETURN|
|,  Up: EN QUAD| | EM QUAD| | EN SPACE| |
 
 
-File: ,  Node: CARRIAGE RETURN| |,  Next: NEXT LINE (NEL)|…| NO-BREAK SPACE| | 
OGHAM SPACE MARK| |,  Prev: CHARACTER TABULATION|       | FORM FEED|| LINE 
TABULATION||,  Up: EN QUAD| | EM QUAD| | EN SPACE| |
+File: ,  Node: CARRIAGE RETURN|
|,  Next: NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |,  Prev: 
CHARACTER TABULATION|        | FORM FEED|| LINE TABULATION||,  Up: EN QUAD| | 
EM QUAD| | EN SPACE| |
 
 
-File: ,  Node: NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |,  
Next: MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |,  Prev: CARRIAGE RETURN| |,  Up: 
EN QUAD| | EM QUAD| | EN SPACE| |
+File: ,  Node: NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |,  
Next: MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |,  Prev: CARRIAGE RETURN|
|,  Up: EN QUAD| | EM QUAD| | EN SPACE| |
 
 
 File: ,  Node: MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |,  Next: THREE-PER-EM 
SPACE| | FOUR-PER-EM SPACE| | SIX-PER-EM SPACE| |,  Prev: NEXT LINE (NEL)|…| 
NO-BREAK SPACE| | OGHAM SPACE MARK| |,  Up: EN QUAD| | EM QUAD| | EN SPACE| |
@@ -1646,14 +1646,14 @@ File: ,  Node: NARROW NO-BREAK SPACE| | MEDIUM 
MATHEMATICAL SPACE| | IDEOGRA
 Tag Table:
 Node: Top 55
 Node: EN QUAD| | EM QUAD| | EN SPACE| |191
-Node: CHARACTER TABULATION|    | FORM FEED|| LINE TABULATION||767
-Node: CARRIAGE RETURN| |914
-Node: NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |1130
-Node: MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |1335
-Node: THREE-PER-EM SPACE| | FOUR-PER-EM SPACE| | SIX-PER-EM SPACE| |1590
-Node: FIGURE SPACE| | PUNCTUATION SPACE| | THIN SPACE| |1841
-Node: HAIR SPACE| | LINE SEPARATOR|
| PARAGRAPH SEPARATOR|
|2108
-Node: NARROW NO-BREAK SPACE| | MEDIUM MATHEMATICAL SPACE| | IDEOGRAPHIC SPACE| 
|2387
+Node: CHARACTER TABULATION|    | FORM FEED|| LINE TABULATION||768
+Node: CARRIAGE RETURN|
|915
+Node: NEXT LINE (NEL)|…| NO-BREAK SPACE| | OGHAM SPACE MARK| |1131
+Node: MONGOLIAN VOWEL SEPARATOR|᠎| EM SPACE| |1336
+Node: THREE-PER-EM SPACE| | FOUR-PER-EM SPACE| | SIX-PER-EM SPACE| |1591
+Node: FIGURE SPACE| | PUNCTUATION SPACE| | THIN SPACE| |1842
+Node: HAIR SPACE| | LINE SEPARATOR|
| PARAGRAPH SEPARATOR|
|2109
+Node: NARROW NO-BREAK SPACE| | MEDIUM MATHEMATICAL SPACE| | IDEOGRAPHIC SPACE| 
|2388
 
 End Tag Table
 



reply via email to

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