Don't cut in the middle of a word.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
937b08ff85
commit
94ca8bffaf
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user