texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Sat, 21 Oct 2023 07:50:15 -0400 (EDT)

branch: master
commit 8f7a316d5266493846981b0741cb1e587f58e064
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Oct 21 12:39:59 2023 +0100

    * tp/Texinfo/XS/xspara.c (xspara__add_next): Eliminate code
    handling control character markers to allow an end of sentence.
    It only handled markers at the end of the string, not throughout,
    and also necessitated modifying the string.  These markers are
    added in Plaintext.pm by _protect_sentence_ends and the result
    should only be passed to add_text (which handles them), not
    to add_next.
---
 ChangeLog              | 10 +++++++++
 tp/Texinfo/XS/xspara.c | 56 ++++++++++++++++++++------------------------------
 2 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2573e22072..ee85f44df9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-10-21  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/XS/xspara.c (xspara__add_next): Eliminate code
+       handling control character markers to allow an end of sentence.
+       It only handled markers at the end of the string, not throughout,
+       and also necessitated modifying the string.  These markers are
+       added in Plaintext.pm by _protect_sentence_ends and the result
+       should only be passed to add_text (which handles them), not
+       to add_next.
+
 2023-10-21  Patrice Dumas  <pertusus@free.fr>
 
        in tp/Texinfo/XS gnulib-tool --add-import unicase/u8-tolower
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 58901d12a8..75f74c59cd 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -693,55 +693,43 @@ xspara__add_next (TEXT *result, char *word, int word_len, 
int transparent)
 {
   dTHX;
 
-  int disinhibit = 0;
   if (!word)
     return;
 
-  if (word_len >= 1 && word[word_len - 1] == '\b')
-    {
-      word[--word_len] = '\0';
-      disinhibit = 1;
-    }
-
   text_append_n (&state.word, word, word_len);
   if (word_len == 0 && word)
     state.invisible_pending_word = 1;
 
   if (!transparent)
     {
-      if (disinhibit)
-        state.last_letter = L'a'; /* a lower-case letter */
-      else
+      /* Save last character in WORD */
+      char *p = word + word_len;
+
+      while (p > word)
         {
-          /* Save last character in WORD */
-          char *p = word + word_len;
+          int len = 0;
+          /* Back one UTF-8 code point */
+          do
+            {
+              p--;
+              len++;
+            }
+          while ((*p & 0xC0) == 0x80 && p > word);
 
-          while (p > word)
+          if (!strchr (end_sentence_characters
+                       after_punctuation_characters, *p))
             {
-              int len = 0;
-              /* Back one UTF-8 code point */
-              do
+              if (!PRINTABLE_ASCII(*p))
                 {
-                  p--;
-                  len++;
+                  wchar_t wc = L'\0';
+                  mbrtowc (&wc, p, len, NULL);
+                  state.last_letter = wc;
+                  break;
                 }
-              while ((*p & 0xC0) == 0x80 && p > word);
-
-              if (!strchr (end_sentence_characters
-                           after_punctuation_characters, *p))
+              else
                 {
-                  if (!PRINTABLE_ASCII(*p))
-                    {
-                      wchar_t wc = L'\0';
-                      mbrtowc (&wc, p, len, NULL);
-                      state.last_letter = wc;
-                      break;
-                    }
-                  else
-                    {
-                      state.last_letter = btowc (*p);
-                      break;
-                    }
+                  state.last_letter = btowc (*p);
+                  break;
                 }
             }
         }



reply via email to

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