From 9872925b7b20d6319ccd87656dfb3ffd51e5c75f Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sun, 11 Mar 2018 19:54:36 -0400 Subject: [PATCH] separate 'if' to return earlier --- src/TerminalDisplay.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index ba3fe270..b31ccbb8 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -1005,6 +1005,11 @@ uint TerminalDisplay::randomSeed() const // Instead only new lines have to be drawn void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion) { + // return if there is nothing to do + if ((lines == 0) || (_image == nullptr)) { + return; + } + // if the flow control warning is enabled this will interfere with the // scrolling optimizations and cause artifacts. the simple solution here // is to just disable the optimization whilst it is visible @@ -1024,9 +1029,7 @@ void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion) region.setBottom(qMin(region.bottom(), this->_lines - 2)); // return if there is nothing to do - if (lines == 0 - || _image == nullptr - || !region.isValid() + if (!region.isValid() || (region.top() + abs(lines)) >= region.bottom() || this->_lines <= region.height()) { return;