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


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next), * tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): Move code into a conditional block as it will only be run if that block is run.
Date: Sun, 09 Apr 2023 07:08:11 -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 738e6de041 * tp/Texinfo/XS/xspara.c (xspara__add_next), * 
tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next): Move code into a conditional 
block as it will only be run if that block is run.
738e6de041 is described below

commit 738e6de0411c7a6e8f398255de4effc06096f5d8
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 9 12:08:02 2023 +0100

    * tp/Texinfo/XS/xspara.c (xspara__add_next),
    * tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next):
    Move code into a conditional block as it will only be run if
    that block is run.
---
 ChangeLog                            |  7 +++++++
 tp/Texinfo/Convert/ParagraphNonXS.pm | 15 ++++++++-------
 tp/Texinfo/XS/xspara.c               | 14 ++++++--------
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0bce6bb7d9..8156b335fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-04-09  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/XS/xspara.c (xspara__add_next),
+       * tp/Texinfo/Convert/ParagraphNonXS.pm (_add_next):
+       Move code into a conditional block as it will only be run if
+       that block is run.
+
 2023-04-09  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/xspara.c (xspara_add_text): Only call mbrtowc
diff --git a/tp/Texinfo/Convert/ParagraphNonXS.pm 
b/tp/Texinfo/Convert/ParagraphNonXS.pm
index 91b04c2b82..1c074121c5 100644
--- a/tp/Texinfo/Convert/ParagraphNonXS.pm
+++ b/tp/Texinfo/Convert/ParagraphNonXS.pm
@@ -228,6 +228,14 @@ sub _add_next($;$$$)
     } else {
       $paragraph->{'word_counter'}
         += Texinfo::Convert::Unicode::string_width($word);
+
+      # The $paragraph->{'counter'} != 0 is here to avoid having an
+      # additional line output when the text is longer than the max.
+      if ($paragraph->{'counter'} != 0 and
+          $paragraph->{'counter'} + $paragraph->{'word_counter'} +
+             length($paragraph->{'space'}) > $paragraph->{'max'}) {
+        $result .= _cut_line($paragraph);
+      }
     }
     if ($paragraph->{'DEBUG'}) {
       my $para_word = 'UNDEF';;
@@ -236,13 +244,6 @@ sub _add_next($;$$$)
       }
       print STDERR "WORD+ $word -> $para_word\n";
     }
-    # The $paragraph->{'counter'} != 0 is here to avoid having an
-    # additional line output when the text is longer than the max.
-    if ($paragraph->{'counter'} != 0 and 
-        $paragraph->{'counter'} + $paragraph->{'word_counter'} + 
-           length($paragraph->{'space'}) > $paragraph->{'max'}) {
-      $result .= _cut_line($paragraph);
-    }
   }
   return $result;
 }
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 434c79262c..b3de2db435 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -735,15 +735,13 @@ xspara__add_next (TEXT *result, char *word, int word_len, 
int transparent)
         }
 
       state.word_counter += len;
-    }
 
-  /* TODO: Shift this into the "else" clause above, because 
-     xspara__end_line would have set state.counter to 0. */
-  if (state.counter != 0
-      && state.counter + state.word_counter + state.space_counter
-          > state.max)
-    {
-      xspara__cut_line (result);
+      if (state.counter != 0
+          && state.counter + state.word_counter + state.space_counter
+              > state.max)
+        {
+          xspara__cut_line (result);
+        }
     }
 }
 



reply via email to

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