summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-24 01:20:39 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-26 08:00:04 -0400
commit0c685b192f46c9455afab301346284e7d426fd5e (patch)
treecee0efcedc6d44a1ff6db4a727c6f8ecd1e50dfb /pango
parentd39ef1d6fc87f33cfdc1ce595e0e34e979e6e06c (diff)
downloadpango-0c685b192f46c9455afab301346284e7d426fd5e.tar.gz
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.
Diffstat (limited to 'pango')
-rw-r--r--pango/break.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pango/break.c b/pango/break.c
index 717ec45f..369a2cb4 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;
}