[pango/more-log-attr-things: 6/8] break: Fix up word fixups




commit 270125e8d763ab93fcdcb863e5d5ed0667bad224
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 26 01:14:07 2021 -0400

    break: Fix up word fixups

 pango/break.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index 5d901ec6..c6ee6da6 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -1867,11 +1867,14 @@ handle_words (const char    *text,
       if (start >= offset)
         {
           gboolean in_word = FALSE;
-          for (pos = start_pos - 1; pos >= 0; pos--)
+          for (pos = start_pos; pos >= 0; pos--)
             {
               if (log_attrs[pos].is_word_end)
-                break;
-              if (log_attrs[pos].is_word_start)
+                {
+                  in_word = pos == start_pos;
+                  break;
+                }
+              if (pos < start_pos && log_attrs[pos].is_word_start)
                 {
                   in_word = TRUE;
                   break;
@@ -1890,11 +1893,14 @@ handle_words (const char    *text,
       if (end < offset + length)
         {
           gboolean in_word = FALSE;
-          for (pos = end_pos + 1; pos < log_attrs_len; pos++)
+          for (pos = end_pos; pos < log_attrs_len; pos++)
             {
               if (log_attrs[pos].is_word_start)
-                break;
-              if (log_attrs[pos].is_word_end)
+                {
+                  in_word = pos == end_pos;
+                  break;
+                }
+              if (pos > end_pos && log_attrs[pos].is_word_end)
                 {
                   in_word = TRUE;
                   break;


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