LibGfx+AK: Make text elision work with multi-byte characters

This was causing WindowServer and Taskbar to crash sometimes when the
stars aligned and we tried cutting off a string ending with "..." right
on top of an emoji. :^)
This commit is contained in:
Andreas Kling 2020-12-28 23:51:24 +01:00
commit 13594b7146
Notes: sideshowbarker 2024-07-19 00:28:56 +09:00
4 changed files with 17 additions and 4 deletions

View file

@ -65,7 +65,7 @@ Utf8CodepointIterator Utf8View::end() const
return { end_ptr(), 0 };
}
int Utf8View::byte_offset_of(const Utf8CodepointIterator& it) const
size_t Utf8View::byte_offset_of(const Utf8CodepointIterator& it) const
{
ASSERT(it.m_ptr >= begin_ptr());
ASSERT(it.m_ptr <= end_ptr());