aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Fourchan.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-12-01 01:33:34 +0100
committerdec05eba <dec05eba@protonmail.com>2019-12-01 01:33:34 +0100
commit312881ac12e1f5d8d6981e4bcea922de1defd643 (patch)
tree8ea62e0211b026ab43cdfac7c6c7651a565c24f4 /src/plugins/Fourchan.cpp
parentf5c3fe255638aa9213209616d579060033d40926 (diff)
Limit number of lines in 4chan threads view
Diffstat (limited to 'src/plugins/Fourchan.cpp')
-rw-r--r--src/plugins/Fourchan.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 11fd3ca..dd2099b 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -514,6 +514,17 @@ namespace QuickMedia {
}
);
html_unescape_sequences(comment_text);
+ // TODO: Do the same when wrapping is implemented
+ int num_lines = 0;
+ for(size_t i = 0; i < comment_text.size(); ++i) {
+ if(comment_text[i] == '\n') {
+ ++num_lines;
+ if(num_lines == 6) {
+ comment_text = comment_text.substr(0, i) + " (...)";
+ break;
+ }
+ }
+ }
auto body_item = std::make_unique<BodyItem>(std::move(comment_text));
body_item->url = std::to_string(thread_num.asInt64());