1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

current folder in first line

This commit is contained in:
Michael 2023-08-10 23:52:16 +02:00 committed by GitHub
parent 48747eea9d
commit c260ce5814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,8 +415,8 @@ void SelectionTab::filter(int size, bool selectFirst)
{ {
auto folder = std::make_shared<ElementInfo>(); auto folder = std::make_shared<ElementInfo>();
folder->isFolder = true; folder->isFolder = true;
folder->folderName = ".."; folder->folderName = ".. (" + curFolder + ")";
auto itemIt = boost::range::find_if(curItems, [](std::shared_ptr<ElementInfo> e) { return e->folderName == ".."; }); auto itemIt = boost::range::find_if(curItems, [](std::shared_ptr<ElementInfo> e) { return boost::starts_with(e->folderName, ".."); });
if (itemIt == curItems.end()) { if (itemIt == curItems.end()) {
curItems.push_back(folder); curItems.push_back(folder);
} }
@ -509,7 +509,7 @@ void SelectionTab::select(int position)
slider->scrollBy(position - (int)listItems.size() + 1); slider->scrollBy(position - (int)listItems.size() + 1);
if(curItems[py]->isFolder) { if(curItems[py]->isFolder) {
if(curItems[py]->folderName == "..") if(boost::starts_with(curItems[py]->folderName, ".."))
{ {
std::vector<std::string> filetree; std::vector<std::string> filetree;
boost::split(filetree, curFolder, boost::is_any_of("/")); boost::split(filetree, curFolder, boost::is_any_of("/"));