[pango/more-log-attr-things: 3/6] break: Fix sentence boundary corner cases




commit 646a84faca69415d9cecc4cec03ad2023e1ed2c4
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 0f85c3fa..5d901ec6 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -939,11 +939,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;
@@ -1541,7 +1541,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]