Append link adter resizing. 🤦
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-12-29 02:16:17 +01:00
parent 2099f48cef
commit d7fb71dc95
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 3 additions and 3 deletions

View File

@ -53,9 +53,8 @@ void MastoAPI::post_item(const Item &item)
}
return s;
}()};
status.append("\n\n" + item.link);
const size_t len_status{status.size()};
const size_t len_status{status.size() + item.link.size() + 2};
const size_t len_append{[&]
{
if (_profile.append.empty())
@ -78,7 +77,6 @@ void MastoAPI::post_item(const Item &item)
if ((len_status + len_append) > len_max)
{
status.resize(len_max - len_append - omission.size());
BOOST_LOG_TRIVIAL(debug) << "Status resized to: " << status.size();
// Don't cut in the middle of a word.
const auto pos = status.rfind(' ');
@ -91,6 +89,8 @@ void MastoAPI::post_item(const Item &item)
BOOST_LOG_TRIVIAL(debug) << "Status resized to: " << status.size();
}
status.append("\n\n" + item.link);
if (!_profile.append.empty())
{
status.append("\n\n" + _profile.append);