Merge pull request #379 from mischnic/attrstr-delete

Fix uiAttributedStringDelete
This commit is contained in:
Pietro Gagliardi 2018-08-09 05:16:52 -04:00 committed by GitHub
commit 419c584523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -263,20 +263,20 @@ void uiAttributedStringDelete(uiAttributedString *s, size_t start, size_t end)
// update the conversion tables
// note the use of <= to include the null terminator
for (i = 0; i <= count; i++)
for (i = 0; i <= (s->len - end); i++)
s->u8tou16[start + i] -= count16;
for (i = 0; i <= count16; i++)
for (i = 0; i <= (s->u16len - end16); i++)
s->u16tou8[start16 + i] -= count;
// null-terminate the string
s->s[start + count] = 0;
s->u16[start16 + count16] = 0;
s->s[start + (s->len - end)] = 0;
s->u16[start16 + (s->u16len - end16)] = 0;
// fix up attributes
uiprivAttrListRemoveCharacters(s->attrs, start, end);
// and finally resize
resize(s, start + count, start16 + count16);
resize(s, s->len - count, s->u16len - count16);
}
void uiAttributedStringSetAttribute(uiAttributedString *s, uiAttribute *a, size_t start, size_t end)