Changeset View
Changeset View
Standalone View
Standalone View
src/SessionController.cpp
Context not available. | |||||
109 | , _findPreviousAction(nullptr) | 109 | , _findPreviousAction(nullptr) | ||
---|---|---|---|---|---|
110 | , _interactionTimer(nullptr) | 110 | , _interactionTimer(nullptr) | ||
111 | , _searchStartLine(0) | 111 | , _searchStartLine(0) | ||
112 | , _prevSearchResultLine(0) | 112 | , _prevSearchResultLine(-1) | ||
113 | , _codecAction(nullptr) | 113 | , _codecAction(nullptr) | ||
114 | , _switchProfileMenu(nullptr) | 114 | , _switchProfileMenu(nullptr) | ||
115 | , _webSearchMenu(nullptr) | 115 | , _webSearchMenu(nullptr) | ||
Context not available. | |||||
1161 | void SessionController::setSearchStartTo(int line) | 1161 | void SessionController::setSearchStartTo(int line) | ||
1162 | { | 1162 | { | ||
1163 | _searchStartLine = line; | 1163 | _searchStartLine = line; | ||
1164 | _prevSearchResultLine = line; | | |||
1165 | } | 1164 | } | ||
1166 | 1165 | | |||
1167 | void SessionController::listenForScreenWindowUpdates() | 1166 | void SessionController::listenForScreenWindowUpdates() | ||
Context not available. | |||||
1179 | 1178 | | |||
1180 | void SessionController::updateSearchFilter() | 1179 | void SessionController::updateSearchFilter() | ||
1181 | { | 1180 | { | ||
1181 | _prevSearchResultLine = -1; | ||||
1182 | if ((_searchFilter != nullptr) && (!_searchBar.isNull())) { | 1182 | if ((_searchFilter != nullptr) && (!_searchBar.isNull())) { | ||
1183 | _view->processFilters(); | 1183 | _view->processFilters(); | ||
1184 | } | 1184 | } | ||
Context not available. | |||||
1205 | return; | 1205 | return; | ||
1206 | } | 1206 | } | ||
1207 | 1207 | | |||
1208 | if (showSearchBar && !_searchBar->isVisible()) { | 1208 | if (showSearchBar && !_searchBar->isVisible() && _searchBar->searchText().isEmpty()) { | ||
1209 | setSearchStartToWindowCurrentLine(); | 1209 | setSearchStartToWindowCurrentLine(); | ||
1210 | } | 1210 | } | ||
1211 | 1211 | | |||
Context not available. | |||||
1214 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, &Konsole::SessionController::searchTextChanged); | 1214 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, &Konsole::SessionController::searchTextChanged); | ||
1215 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchReturnPressed, this, &Konsole::SessionController::findPreviousInHistory); | 1215 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchReturnPressed, this, &Konsole::SessionController::findPreviousInHistory); | ||
1216 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchShiftPlusReturnPressed, this, &Konsole::SessionController::findNextInHistory); | 1216 | connect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchShiftPlusReturnPressed, this, &Konsole::SessionController::findNextInHistory); | ||
1217 | if ((!_view.isNull()) && (_view->screenWindow() != nullptr)) { | ||||
1218 | _view->screenWindow()->setCurrentResultLine(_prevSearchResultLine); | ||||
1219 | } | ||||
1217 | } else { | 1220 | } else { | ||
1218 | disconnect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, | 1221 | disconnect(_searchBar.data(), &Konsole::IncrementalSearchBar::searchChanged, this, | ||
1219 | &Konsole::SessionController::searchTextChanged); | 1222 | &Konsole::SessionController::searchTextChanged); | ||
Context not available. | |||||
1297 | return; | 1300 | return; | ||
1298 | } | 1301 | } | ||
1299 | 1302 | | |||
1300 | _searchText = text; | 1303 | if (_searchText.isEmpty()) { | ||
1301 | 1304 | setSearchStartToWindowCurrentLine(); | |||
1302 | if (text.isEmpty()) { | | |||
1303 | _view->screenWindow()->clearSelection(); | | |||
1304 | _view->screenWindow()->scrollTo(_searchStartLine); | | |||
1305 | } | 1305 | } | ||
1306 | 1306 | | |||
1307 | _searchText = text; | ||||
1308 | | ||||
1307 | // update search. this is called even when the text is | 1309 | // update search. this is called even when the text is | ||
1308 | // empty to clear the view's filters | 1310 | // empty to clear the view's filters | ||
1309 | beginSearch(text , reverseSearchChecked() ? Enum::BackwardsSearch : Enum::ForwardsSearch); | 1311 | beginSearch(text , reverseSearchChecked() ? Enum::BackwardsSearch : Enum::ForwardsSearch); | ||
Context not available. | |||||
1333 | } | 1335 | } | ||
1334 | } | 1336 | } | ||
1335 | 1337 | | |||
1338 | | ||||
1336 | if (!regExp.pattern().isEmpty()) { | 1339 | if (!regExp.pattern().isEmpty()) { | ||
1337 | _view->screenWindow()->setCurrentResultLine(-1); | | |||
1338 | auto task = new SearchHistoryTask(this); | 1340 | auto task = new SearchHistoryTask(this); | ||
1339 | 1341 | | |||
1340 | connect(task, &Konsole::SearchHistoryTask::completed, this, &Konsole::SessionController::searchCompleted); | 1342 | connect(task, &Konsole::SearchHistoryTask::completed, this, &Konsole::SessionController::searchCompleted); | ||
Context not available. | |||||
1346 | task->addScreenWindow(_session , _view->screenWindow()); | 1348 | task->addScreenWindow(_session , _view->screenWindow()); | ||
1347 | task->execute(); | 1349 | task->execute(); | ||
1348 | } else if (text.isEmpty()) { | 1350 | } else if (text.isEmpty()) { | ||
1351 | _view->screenWindow()->setCurrentResultLine(-1); | ||||
1349 | searchCompleted(false); | 1352 | searchCompleted(false); | ||
1350 | } | 1353 | } | ||
1351 | 1354 | | |||
Context not available. |