From 312881ac12e1f5d8d6981e4bcea922de1defd643 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 1 Dec 2019 01:33:34 +0100 Subject: Limit number of lines in 4chan threads view --- src/plugins/Fourchan.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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(std::move(comment_text)); body_item->url = std::to_string(thread_num.asInt64()); -- cgit v1.2.3