From ae0c82121dedb3df1e15868a0ff4e659c1e6e38b Mon Sep 17 00:00:00 2001 From: CristinaCristescu Date: Tue, 19 Jul 2016 11:46:57 +0200 Subject: [PATCH] Cling UITabCompletion. --- lib/UserInterface/UserInterface.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/UserInterface/UserInterface.cpp b/lib/UserInterface/UserInterface.cpp index b0509b06..a6b94d12 100644 --- a/lib/UserInterface/UserInterface.cpp +++ b/lib/UserInterface/UserInterface.cpp @@ -12,6 +12,7 @@ #include "cling/UserInterface/CompilationException.h" #include "cling/Interpreter/Exception.h" #include "cling/MetaProcessor/MetaProcessor.h" +#include "textinput/Callbacks.h" #include "textinput/TextInput.h" #include "textinput/StreamReader.h" #include "textinput/TerminalDisplay.h" @@ -90,18 +91,20 @@ namespace { /// to code complete through its own textinput mechanism which is part of the /// UserInterface. /// - class TabCompletion : public textinput::TabCompletion { - const Interpreter& m_ParentInterpreter; + class UITabCompletion : public textinput::TabCompletion { + const cling::Interpreter& m_ParentInterpreter; public: - TabCompletion(const Interpreter& Parent) : m_ParentInterpreter(Parent) {} - ~TabCompletion() {} + UITabCompletion(const cling::Interpreter& Parent) : + m_ParentInterpreter(Parent) {} + ~UITabCompletion() {} bool Complete(textinput::Text& Line /*in+out*/, - size_t& Cursor /*in+out*/, - textinput::EditorRange& R /*out*/, - std::vector& Completions /*out*/) override { - m_ParentInterpreter->codeComplete(Line.GetText(), Cursor, Completions); + size_t& Cursor /*in+out*/, + textinput::EditorRange& R /*out*/, + std::vector& Completions /*out*/) override { + m_ParentInterpreter.codeComplete(Line.GetText(), Cursor, Completions); + return true; } }; } @@ -141,8 +144,8 @@ namespace cling { // Inform text input about the code complete consumer // TextInput owns the TabCompletion. - TabCompletion* Completion = - new cling::TabCompletion(m_MetaProcessor->getInterpreter()); + UITabCompletion* Completion = + new UITabCompletion(m_MetaProcessor->getInterpreter()); TI.SetCompletion(Completion); TI.SetPrompt("[cling]$ ");