summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-04-04 19:09:34 +0200
committerMaxime Coste <frrrwww@gmail.com>2013-04-04 19:09:34 +0200
commit9bb9eda302ba20ce875ba702003458807da2003e (patch)
treeb7c175c3e317297584f52b8f80fd1a4bc900a09d /src/input_handler.cc
parent6e2fa38c15e7e1bdb50498697b22a195782a4018 (diff)
Dynamically change prompt color for regex prompt depending on regex validity
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 1222b379..a8b161cb 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -433,6 +433,15 @@ public:
m_callback(line, PromptEvent::Change, context());
}
+ void set_prompt_colors(ColorPair colors)
+ {
+ if (colors != m_prompt_colors)
+ {
+ m_prompt_colors = colors;
+ display();
+ }
+ }
+
private:
void display() const
{
@@ -799,6 +808,13 @@ void InputHandler::prompt(const String& prompt, ColorPair prompt_colors,
completer, callback));
}
+void InputHandler::set_prompt_colors(ColorPair prompt_colors)
+{
+ InputModes::Prompt* prompt = dynamic_cast<InputModes::Prompt*>(m_mode.get());
+ if (prompt)
+ prompt->set_prompt_colors(prompt_colors);
+}
+
void InputHandler::menu(const memoryview<String>& choices,
MenuCallback callback)
{