]> granicus.if.org Git - icinga2/commitdiff
Fix: Console auto-completion should take into account parent classes' prototypes
authorGunnar Beutner <gunnar@beutner.name>
Wed, 26 Aug 2015 07:02:31 +0000 (09:02 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 26 Aug 2015 07:02:31 +0000 (09:02 +0200)
fixes #9843

lib/cli/consolecommand.cpp

index e7b96b968840e8f0ee04fabb4aed6153f770ce2a..1ff9cd4f3d7943daef275cbdc982940abd8fa823 100644 (file)
@@ -128,14 +128,18 @@ static char *ConsoleCompleteHelper(const char *word, int state)
                                        AddSuggestion(matches, word, pword + "." + field.Name);
                                }
 
-                               Object::Ptr prototype = type->GetPrototype();
-                               Dictionary::Ptr dict = dynamic_pointer_cast<Dictionary>(prototype);
-
-                               if (dict) {
-                                       ObjectLock olock(dict);
-                                       BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
-                                               AddSuggestion(matches, word, pword + "." + kv.first);
+                               while (type) {
+                                       Object::Ptr prototype = type->GetPrototype();
+                                       Dictionary::Ptr dict = dynamic_pointer_cast<Dictionary>(prototype);
+
+                                       if (dict) {
+                                               ObjectLock olock(dict);
+                                               BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
+                                                       AddSuggestion(matches, word, pword + "." + kv.first);
+                                               }
                                        }
+
+                                       type = type->GetBaseType();
                                }
                        } catch (...) { /* Ignore the exception */ }
                }