Skip to content

Commit

Permalink
Merge pull request #5233 from seanyeh/fix-load-game-filter-long-filen…
Browse files Browse the repository at this point in the history
…ames

Fix load game search filter for long filenames (fixes #5156)
  • Loading branch information
Vultraz committed Oct 25, 2020
2 parents 9573f66 + fd51cdc commit dc64380
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/gui/dialogs/game_load.cpp
Expand Up @@ -346,21 +346,18 @@ void game_load::filter_text_changed(text_box_base* textbox, const std::string& t
show_items.resize(list.get_item_count(), true);

if(!text.empty()) {
for(unsigned int i = 0; i < list.get_item_count(); i++) {
for(unsigned int i = 0; i < list.get_item_count() && i < games_.size(); i++) {
grid* row = list.get_row_grid(i);

grid::iterator it = row->begin();
label& filename_label = find_widget<label>(*it, "filename", false);

bool found = false;
for(const auto & word : words)
{
found = std::search(filename_label.get_label().str().begin(),
filename_label.get_label().str().end(),
found = std::search(games_[i].name().begin(),
games_[i].name().end(),
word.begin(),
word.end(),
chars_equal_insensitive)
!= filename_label.get_label().str().end();
!= games_[i].name().end();

if(!found) {
// one word doesn't match, we don't reach words.end()
Expand Down

0 comments on commit dc64380

Please sign in to comment.