diff --git a/screenshot.html b/screenshot.html
index b9bd3a422..9bbde632a 100644
--- a/screenshot.html
+++ b/screenshot.html
@@ -293,13 +293,17 @@
});
let height;
const body = document.body;
-myCodeMirror.on('change', function() {
+
+myCodeMirror.on('change', adjust_height);
+myCodeMirror.on('inputRead', adjust_height);
+
+funtion adjust_height() {
var rect = dialog.getBoundingClientRect();
if (height !== rect.height) {
height = rect.height;
body.style.setProperty('--height', rect.height + 300);
}
-});
+}