From 5cf48432128e57cf2af13c9c324fef84b1fa69ed Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Sun, 28 Jan 2018 21:40:18 +0100
Subject: [PATCH] Fix broken screenshots of tweets with just one line of text

---
 Resources/Scripts/code.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index b441897c..aa203674 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -708,9 +708,13 @@
           width: tweetWidth+"px"
         }).appendTo(document.body);
         
-        let realHeight = Math.floor(testTweet.height());
+        let testTweetAvatar = testTweet.find(".tweet-avatar").first();
+        let avatarBottom = testTweetAvatar.offset().top+testTweetAvatar.height();
+        
+        let realHeight = Math.floor(Math.max(testTweet.height(), avatarBottom+10));
         testTweet.remove();
         
+        selectedTweet.find(".js-stream-item-content").first().css("height", "100vh");
         $TD.screenshotTweet(selectedTweet.html(), tweetWidth, realHeight);
       }
     };