← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2358: fix the file list search history list

 

------------------------------------------------------------
revno: 2358
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-12-21 16:07:21 +0100
message:
  fix the file list search history list
modified:
  win32/DirectoryListingFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2010-12-21 14:40:47 +0000
+++ win32/DirectoryListingFrame.cpp	2010-12-21 15:07:21 +0000
@@ -928,14 +928,18 @@
 		return;
 
 	{
+		// make sure the new search string is at the top of the list
 		auto prev = std::find(lastSearches.begin(), lastSearches.end(), findStr);
 		if(prev == lastSearches.end()) {
 			size_t i = max(SETTING(SEARCH_HISTORY) - 1, 0);
 			while(lastSearches.size() > i) {
 				lastSearches.erase(lastSearches.begin());
 			}
-		} else
+		} else {
+			searchBox->erase(lastSearches.end() - 1 - prev); // the GUI list is in reverse order...
+			searchBox->setText(findStr); // it erases the text-box too...
 			lastSearches.erase(prev);
+		}
 		lastSearches.push_back(findStr);
 		searchBox->insertValue(0, findStr);
 	}