texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text)


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text) <spaces>: Separate out code for 'unfilled' to make the rest of the code easier to understand.
Date: Sun, 11 Dec 2022 12:16:11 -0500

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 f43c58d727 * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text) <spaces>: 
Separate out code for 'unfilled' to make the rest of the code easier to 
understand.
f43c58d727 is described below

commit f43c58d727e52050270ccd003667ee709b29fb54
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Dec 11 17:15:24 2022 +0000

    * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text) <spaces>:
    Separate out code for 'unfilled' to make the rest of the code
    easier to understand.
---
 ChangeLog                            |  6 ++++++
 tp/Texinfo/Convert/ParagraphNonXS.pm | 32 ++++++++++++++------------------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 03ceae9dd0..bf2b4200d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-12-11  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/ParagraphNonXS.pm (add_text) <spaces>:
+       Separate out code for 'unfilled' to make the rest of the code
+       easier to understand.
+
 2022-12-11  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm 
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index 1cb442846b..dd0e0633ff 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -329,7 +329,15 @@ sub add_text($$)
     if (defined $spaces) {
       print STDERR "SPACES($paragraph->{'counter'}) `"
           ._print_escaped_spaces($spaces)."'\n" if $debug_flag;
-      if ($protect_spaces_flag) {
+      if ($paragraph->{'unfilled'}) {
+        $result .= _add_pending_word($paragraph);
+        if ($spaces =~ /\n/) {
+          $result .= _add_pending_word ($paragraph);
+          $result .= _end_line ($paragraph);
+        } else {
+          $paragraph->{'space'} .= $spaces;
+        }
+      } elsif ($protect_spaces_flag) {
         $paragraph->{'word'} .= $spaces;
         $paragraph->{'last_char'} = substr($spaces, -1);
         $paragraph->{'word_counter'} += length($spaces);
@@ -344,32 +352,20 @@ sub add_text($$)
         }
       } else {
         my $pending_word = $paragraph->{'word'};
-
         $result .= _add_pending_word($paragraph);
-        if ($paragraph->{'counter'} != 0 or $paragraph->{'unfilled'}
+        if ($paragraph->{'counter'} != 0
             or (defined $pending_word)) {
           if ($paragraph->{'end_sentence'} 
               and $paragraph->{'end_sentence'} > 0
-              and !$paragraph->{'frenchspacing'}
-              and !$paragraph->{'unfilled'}) {
+              and !$paragraph->{'frenchspacing'}) {
             $paragraph->{'space'} = '  ';
           } else {
             # Only save the first space
-            if ($paragraph->{'unfilled'}
-                or length($paragraph->{'space'}) < 1) {
+            if (length($paragraph->{'space'}) < 1) {
               if ($spaces =~ /\n/) {
-                if (!$paragraph->{'unfilled'}) {
-                  $paragraph->{'space'} = ' ';
-                } else {
-                  $result .= _add_pending_word ($paragraph);
-                  $result .= _end_line ($paragraph);
-                }
+                $paragraph->{'space'} = ' ';
               } else {
-                if (!$paragraph->{'unfilled'}) {
-                  $paragraph->{'space'} .= substr ($spaces, 0, 1);
-                } else {
-                  $paragraph->{'space'} .= $spaces;
-                }
+                $paragraph->{'space'} .= substr ($spaces, 0, 1);
               }
             }
           }



reply via email to

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