Don't cut in the middle of a word.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-12-29 00:10:13 +01:00
parent 937b08ff85
commit 94ca8bffaf
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,14 @@ void MastoAPI::post_item(const Item &item)
if ((len + len_append) > len_max)
{
status.resize(len_max - len_append - omission.size());
// Don't cut in the middle of a word.
const auto pos = status.rfind(' ');
if (pos != string::npos)
{
status.resize(status.size() - pos);
}
status.append(omission);
}