Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3fc9fab7 authored by Thomas Surrel's avatar Thomas Surrel Committed by Kurt Hindenburg

Fix search result highlight when scrolling

Summary:
The highlighted line of a search result is not updated correctly
when scrolling a screen with repeated lines.

Test Plan:
cat a file containing the same line repeated many times.
Search for a string, then scroll: the highlight line should
be displayed correctly.

{F6414451}

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16820
parent 274214f4
......@@ -1276,7 +1276,6 @@ void TerminalDisplay::updateImage()
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 @@ void TerminalDisplay::updateImage()
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 @@ void TerminalDisplay::drawCurrentResultRect(QPainter& painter)
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
......
......@@ -1079,6 +1079,7 @@ private:
ScrollState _scrollWheelState;
IncrementalSearchBar *_searchBar;
QRect _searchResultRect;
friend class TerminalDisplayAccessible;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment