[pango/log-attr-tweaks] break: Fix sentence boundary corner cases



commit 94ec7db26473954062544556419f70c9208fe6ee
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 24 01:20:39 2021 -0400

    break: Fix sentence boundary corner cases
    
    We were not correctly handling the case where
    wipe out a sentence boundary after the fact,
    and were leaving behind a stray sentence end.

 pango/break.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index 8780392e..22b8ece3 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -935,11 +935,11 @@ default_break (const char    *text,
                     SB_type == SB_Lower)
               {
                attrs[prev_SB_i].is_sentence_boundary = FALSE;
-               attrs[prev_SB_i].is_sentence_start = FALSE;
                attrs[prev_SB_i].is_sentence_end = FALSE;
                 last_sentence_start = -1;
                 for (int j = prev_SB_i - 1; j >= 0; j--)
                   {
+                    attrs[j].is_sentence_end = FALSE;
                     if (attrs[j].is_sentence_boundary)
                       {
                         last_sentence_start = j;
@@ -1537,7 +1537,7 @@ default_break (const char    *text,
 
        /* meets sentence end, mark both sentence start and end */
        if (last_sentence_start != -1 && is_sentence_boundary) {
-         if (last_non_space != -1) {
+         if (last_non_space >= last_sentence_start) {
            attrs[last_sentence_start].is_sentence_start = TRUE;
            attrs[last_non_space].is_sentence_end = TRUE;
          }


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