Fixed an off by one error when identifying best entries for typeahead on the file selection and software list dialogs

This commit is contained in:
Nathan Woods 2016-09-24 08:56:00 -04:00
parent 29b7072043
commit e8f19ee9e8
2 changed files with 2 additions and 2 deletions

View File

@ -446,7 +446,7 @@ void menu_file_selector::handle()
if (cur_selected != &entry) if (cur_selected != &entry)
{ {
int match = 0; int match = 0;
for (int i = 0; i < m_filename.size(); i++) for (int i = 0; i < m_filename.size() + 1; i++)
{ {
if (core_strnicmp(entry.basename.c_str(), m_filename.c_str(), i) == 0) if (core_strnicmp(entry.basename.c_str(), m_filename.c_str(), i) == 0)
match = i; match = i;

View File

@ -280,7 +280,7 @@ void menu_software_list::handle()
auto &compare_name = m_ordered_by_shortname ? entry.short_name : entry.long_name; auto &compare_name = m_ordered_by_shortname ? entry.short_name : entry.long_name;
int match = 0; int match = 0;
for (int i = 0; i < m_filename_buffer.length(); i++) for (int i = 0; i < m_filename_buffer.size() + 1; i++)
{ {
if (core_strnicmp(compare_name.c_str(), m_filename_buffer.c_str(), i) == 0) if (core_strnicmp(compare_name.c_str(), m_filename_buffer.c_str(), i) == 0)
match = i; match = i;