Commit 2a090c41 authored by Robert Knight's avatar Robert Knight
Browse files

Fix bug where search result highlights in the terminal display did not move...

Fix bug where search result highlights in the terminal display did not move when the display was scrolled.  When the search bar is active, update the filters and the view whenever it is scrolled or the output otherwise changes.  This has a perceptible (but in future fixable) performance impact when scrolling with the search bar active.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=756104
parent 35e004fb
......@@ -84,6 +84,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
, _urlFilterUpdateRequired(false)
, _codecAction(0)
, _changeProfileMenu(0)
, _listenForScreenWindowUpdates(false)
{
Q_ASSERT( session );
Q_ASSERT( view );
......@@ -132,6 +133,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
connect( _session->emulation() , SIGNAL(outputChanged()) , this ,
SLOT(fireActivity()) );
// listen for flow control status changes
connect( _session , SIGNAL(flowControlEnabledChanged(bool)) , _view ,
SLOT(setFlowControlWarningEnabled(bool)) );
......@@ -149,6 +151,18 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
connect( activityTimer , SIGNAL(timeout()) , this , SLOT(snapshot()) );
}
void SessionController::updateSearchFilter()
{
if ( _searchFilter )
{
Q_ASSERT( searchBar() && searchBar()->isVisible() );
_view->processFilters();
// TODO - Optimize by only repainting the affected regions
_view->update();
}
}
SessionController::~SessionController()
{
if ( _view )
......@@ -706,6 +720,19 @@ void SessionController::searchHistory()
}
#endif
void SessionController::listenForScreenWindowUpdates()
{
if (_listenForScreenWindowUpdates)
return;
connect( _view->screenWindow() , SIGNAL(outputChanged()) , this ,
SLOT(updateSearchFilter()) );
connect( _view->screenWindow() , SIGNAL(scrolled(int)) , this ,
SLOT(updateSearchFilter()) );
_listenForScreenWindowUpdates = true;
}
// searchHistory() may be called either as a result of clicking a menu item or
// as a result of changing the search bar widget
void SessionController::searchHistory(bool showSearchBar)
......@@ -718,6 +745,8 @@ void SessionController::searchHistory(bool showSearchBar)
{
removeSearchFilter();
listenForScreenWindowUpdates();
_searchFilter = new RegExpFilter();
_view->filterChain()->addFilter(_searchFilter);
connect( _searchBar , SIGNAL(searchChanged(const QString&)) , this ,
......
......@@ -200,6 +200,8 @@ private slots:
void trackOutput(); // move view to end of current output
void updateSearchFilter();
// debugging slots
void debugProcess();
......@@ -212,6 +214,7 @@ private:
void setupActions();
void removeSearchFilter(); // remove and delete the current search filter if set
void setFindNextPrevEnabled(bool enabled);
void listenForScreenWindowUpdates();
private:
static KIcon _activityIcon;
......@@ -241,6 +244,8 @@ private:
KCodecAction* _codecAction;
KMenu* _changeProfileMenu;
bool _listenForScreenWindowUpdates;
};
/**
......
......@@ -798,7 +798,11 @@ void TerminalDisplay::processFilters()
QTime t;
t.start();
_filterChain->setImage(_image,_lines,_columns,_lineProperties);
_filterChain->setImage( _screenWindow->getImage(),
_screenWindow->windowLines(),
_screenWindow->windowColumns(),
_screenWindow->getLineProperties() );
//_filterChain->setImage( /*_image*/,_lines,_columns,_lineProperties);
_filterChain->process();
}
......
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