From d54d6513b6034a798c8d5fe7f503296bf1b79996 Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 30 Aug 2018 01:24:19 +0200 Subject: [PATCH] =?UTF-8?q?This=20REALLY=20fixes=20bug=20#1=20(I=20checked?= =?UTF-8?q?=20the=20size,=20but=20not=20properly=20resized=20the=20content?= =?UTF-8?q?=20=F0=9F=A4=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- src/parse.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f949ce7..b97ff60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.6) project (mastorss - VERSION 0.7.6 + VERSION 0.7.7 LANGUAGES CXX ) diff --git a/src/parse.cpp b/src/parse.cpp index aec953c..390c1b0 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -155,8 +155,9 @@ std::vector parse_website(const string &xml) for (const string &hashtag : watchwords) { - std::regex rehashtag("([[:space:][:punct:]]|^)(" + hashtag + - ")([[:space:][:punct:]]|$)", std::regex_constants::icase); + std::regex rehashtag("([[:space:][:punct:]]|^)(" + hashtag + + ")([[:space:][:punct:]]|$)", + std::regex_constants::icase); content = std::regex_replace(content, rehashtag, "$1#$2$3", std::regex_constants::format_first_only); } @@ -167,7 +168,8 @@ std::vector parse_website(const string &xml) if ((status.spoiler_text().size() + content.size() + link.size() + appendix_size) > static_cast(max_size - 4)) { - content.resize((max_size - link.size() - appendix_size - 4)); + content.resize((max_size - status.spoiler_text().size() + - link.size() - appendix_size - 4)); content.resize(content.rfind(' ')); // Cut at word boundary content += " […]"; }