diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -1079,6 +1079,7 @@ ScrollState _scrollWheelState; IncrementalSearchBar *_searchBar; + QRect _searchResultRect; friend class TerminalDisplayAccessible; }; diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -1276,7 +1276,6 @@ if (!(WindowSystemInfo::HAVE_TRANSPARENCY && (qApp->devicePixelRatio() > 1.0)) && _wallpaper->isNull() && !_searchBar->isVisible()) { scrollImage(_screenWindow->scrollCount() , _screenWindow->scrollRegion()); - _screenWindow->resetScrollCount(); } if (_image == nullptr) { @@ -1433,6 +1432,16 @@ dirtyRegion |= _inputMethodData.previousPreeditRect; + if ((_screenWindow->currentResultLine() != -1) && (_screenWindow->scrollCount())) { + // De-highlight previous result region + dirtyRegion |= _searchResultRect; + // Highlight new result region + dirtyRegion |= QRect(0, _contentRect.top() + (_screenWindow->currentResultLine() - _screenWindow->currentLine()) * _fontHeight, + _columns * _fontWidth, _fontHeight); + } + _screenWindow->resetScrollCount(); + + // update the parts of the display which have changed update(dirtyRegion); @@ -1883,9 +1892,9 @@ return; } - QRect r(0, _contentRect.top() + (_screenWindow->currentResultLine() - _screenWindow->currentLine()) * _fontHeight, - _columns * _fontWidth, _fontHeight); - painter.fillRect(r, QColor(0, 0, 255, 80)); + _searchResultRect.setRect(0, _contentRect.top() + (_screenWindow->currentResultLine() - _screenWindow->currentLine()) * _fontHeight, + _columns * _fontWidth, _fontHeight); + painter.fillRect(_searchResultRect, QColor(0, 0, 255, 80)); } QRect TerminalDisplay::imageToWidget(const QRect& imageArea) const