From d7fb71dc9523620935bdc641c5fec0000af80467 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 29 Dec 2019 02:16:17 +0100 Subject: [PATCH] =?UTF-8?q?Append=20link=20adter=20resizing.=20?= =?UTF-8?q?=F0=9F=A4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mastoapi.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mastoapi.cpp b/src/mastoapi.cpp index 1622b80..0e9de8c 100644 --- a/src/mastoapi.cpp +++ b/src/mastoapi.cpp @@ -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);