diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index e5e723e720..564e0c0f4c 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -47,6 +47,7 @@ #include "pbd/error.h" #include "pbd/openuri.h" #include "pbd/strsplit.h" +#include "pbd/unwind.h" #include "ardour/filesystem_paths.h" #include "ardour/profile.h" @@ -492,22 +493,38 @@ KeyEditor::Tab::visible_func(const Gtk::TreeModel::const_iterator& iter) const } // never filter when search string is empty or item is a category - if (owner.filter_string.empty () || !(*iter)[columns.bindable]) { + if (owner.filter_string.empty ()) { return true; } - // search name - std::string name = (*iter)[columns.name]; - boost::to_lower (name); - if (name.find (owner.filter_string) != std::string::npos) { - return true; + if (!(*iter)[columns.bindable]) { + + for (auto const & c : iter->children()) { + if (visible_func (c)) { + TreeModel::Path p (data_model->get_path (iter)); + view.expand_row (p, false); + return true; + } + } + + return false; } - // search binding - std::string binding = (*iter)[columns.binding]; - boost::to_lower (binding); - if (binding.find (owner.filter_string) != std::string::npos) { - return true; + if (owner.filter_string.find ("k:") == string::npos) { + // search name + std::string name = (*iter)[columns.name]; + boost::to_lower (name); + if (name.find (owner.filter_string) != std::string::npos) { + return true; + } + } else { + string s = owner.filter_string.substr (2); + // search binding + std::string binding = (*iter)[columns.binding]; + boost::to_lower (binding); + if (binding.find (s) != std::string::npos) { + return true; + } } return false; diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index 268c1a34a0..91adadbe74 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -90,7 +90,7 @@ private: std::string name; Gtkmm2ext::Bindings* bindings; Gtk::ScrolledWindow scroller; - Gtk::TreeView view; + mutable Gtk::TreeView view; Glib::RefPtr data_model; Glib::RefPtr filter; Glib::RefPtr sorted_filter;