From: Gunnar Beutner Date: Wed, 26 Aug 2015 07:02:31 +0000 (+0200) Subject: Fix: Console auto-completion should take into account parent classes' prototypes X-Git-Tag: v2.4.0~372 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21099445803beaa934b6bb0a0f0c268a94cd43ba;p=icinga2 Fix: Console auto-completion should take into account parent classes' prototypes fixes #9843 --- diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index e7b96b968..1ff9cd4f3 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -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(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(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 */ } }