summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2016-12-23 16:23:31 +0000
committerMaxime Coste <mawww@kakoune.org>2016-12-23 16:23:31 +0000
commitd17bed9b80183bb80ae560200d08bacfaac679c2 (patch)
tree0855c46ed2372a216b407257c514ccca88d06e1f /src/normal.cc
parent62df6dbb46ce00be1031e907d222116864431888 (diff)
Display the command prompt in error face when the command is not found
Fixes #1021
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 282d18e6..54cbbc6c 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -366,16 +366,21 @@ void command(Context& context, NormalParams params)
if (context.has_client())
{
context.client().info_hide();
- auto autoinfo = context.options()["autoinfo"].get<AutoInfo>();
- if (event == PromptEvent::Change and autoinfo & AutoInfo::Command)
+ if (event == PromptEvent::Change)
{
- if (cmdline.length() == 1 and is_horizontal_blank(cmdline[0_byte]))
- context.client().info_show("prompt", "commands preceded by a blank wont be saved to history",
- {}, InfoStyle::Prompt);
-
auto info = CommandManager::instance().command_info(context, cmdline);
- if (not info.first.empty() and not info.second.empty())
- context.client().info_show(info.first, info.second, {}, InfoStyle::Prompt);
+ context.input_handler().set_prompt_face(get_face(info ? "Prompt" : "Error"));
+
+ auto autoinfo = context.options()["autoinfo"].get<AutoInfo>();
+ if (autoinfo & AutoInfo::Command)
+ {
+ if (cmdline.length() == 1 and is_horizontal_blank(cmdline[0_byte]))
+ context.client().info_show("prompt",
+ "commands preceded by a blank wont be saved to history",
+ {}, InfoStyle::Prompt);
+ else if (info and not info->info.empty())
+ context.client().info_show(info->name, info->info, {}, InfoStyle::Prompt);
+ }
}
}
if (event == PromptEvent::Validate)