diff options
author | 2017-05-10 14:15:04 -0400 | |
---|---|---|
committer | 2017-05-10 14:20:32 -0400 | |
commit | dccefed038b63d718deb0d6046d8a72b3d1151f5 (patch) | |
tree | e13b2a0f0595a6ff8b50b81e37a8c41ad96237d0 /src/frontend/mame/ui/selector.cpp | |
parent | 2b94a4a300951fd79711ac83fc4f169a25e8d539 (diff) |
Fix bug that permanently disabled some UI search strings when they were cleared
(nw) This adopts std::string::clear() and empty() consistently, rather than storing and checking for NUL as with C-style buffers. This fixes issue #2295 and probably other unreported bugs afflicting UI search text input.
Diffstat (limited to 'src/frontend/mame/ui/selector.cpp')
-rw-r--r-- | src/frontend/mame/ui/selector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp index 83af27c4b72..8d5dd900e13 100644 --- a/src/frontend/mame/ui/selector.cpp +++ b/src/frontend/mame/ui/selector.cpp @@ -23,25 +23,25 @@ namespace ui { menu_selector::menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> const &s_sel, uint16_t &s_actual, int category, int _hover) : menu(mui, container) + , m_search() , m_selector(s_actual) , m_category(category) , m_hover(_hover) , m_first_pass(true) , m_str_items(s_sel) { - m_search[0] = '\0'; m_searchlist[0] = nullptr; } menu_selector::menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> &&s_sel, uint16_t &s_actual, int category, int _hover) : menu(mui, container) + , m_search() , m_selector(s_actual) , m_category(category) , m_hover(_hover) , m_first_pass(true) , m_str_items(std::move(s_sel)) { - m_search[0] = '\0'; m_searchlist[0] = nullptr; } @@ -104,7 +104,7 @@ void menu_selector::handle() } // escape pressed with non-empty text clears the text - else if (menu_event->iptkey == IPT_UI_CANCEL && m_search[0] != 0) + else if (menu_event->iptkey == IPT_UI_CANCEL && !m_search.empty()) { m_search.clear(); reset(reset_options::SELECT_FIRST); |