diff options
-rw-r--r-- | src/ui/inputbox.cc | 11 | ||||
-rw-r--r-- | src/ui/inputbox.h | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/inputbox.cc b/src/ui/inputbox.cc index 5656cb9..89e3243 100644 --- a/src/ui/inputbox.cc +++ b/src/ui/inputbox.cc @@ -142,15 +142,14 @@ void InputBox::draw() Paint::set_color(palette()->foreground()); } +void InputBox::complete() +{ + core::CommandBuffer::complete(input_text, input_pos); +} + bool InputBox::on_keypress(const int key, const unsigned int modifier) { switch (key) { - case SDLK_TAB: - // FIXME should not be here - core::CommandBuffer::complete(input_text, input_pos); - return true; - break; - case SDLK_HOME: input_pos = 0; return true; diff --git a/src/ui/inputbox.h b/src/ui/inputbox.h index d3e9d2c..5da9bc5 100644 --- a/src/ui/inputbox.h +++ b/src/ui/inputbox.h @@ -35,12 +35,15 @@ public: void set_max(const size_t max); /// return the text displayed by the label - inline std::string const &text() const { + inline const std::string &text() const { return input_text; } - + /// clear the text void clear(); + + /// run command completion + void complete(); protected: /// draw the widget |