diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-12-01 01:33:34 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-12-01 01:33:34 +0100 |
commit | 312881ac12e1f5d8d6981e4bcea922de1defd643 (patch) | |
tree | 8ea62e0211b026ab43cdfac7c6c7651a565c24f4 | |
parent | f5c3fe255638aa9213209616d579060033d40926 (diff) |
Limit number of lines in 4chan threads view
-rw-r--r-- | src/plugins/Fourchan.cpp | 11 |
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()); |