From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 4 Nov 2013 19:00:45 +0000 (+0100)
Subject: Show error message if ex command is not known.
X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=c46f20073ad5349964bfa8e4c816b1c9068495d1;p=vimb.git

Show error message if ex command is not known.
---

diff --git a/src/ex.c b/src/ex.c
index 14a463e..567b5c5 100644
--- a/src/ex.c
+++ b/src/ex.c
@@ -506,7 +506,15 @@ static gboolean parse_command_name(const char **input, ExArg *arg)
     } while (matches > 0 && **input && **input != ' ' && **input != '!');
 
     if (!matches) {
-        /* TODO show readable error message */
+        /* read until next whitespace or end of input to get command name for
+         * error message - vim uses the whole rest of the input string - but
+         * the first word seems to bee enough for the error message */
+        for (; len < LENGTH(cmd) && *input && **input != ' '; (*input)++) {
+            cmd[len++] = **input;
+        }
+        cmd[len] = '\0';
+
+        vb_echo(VB_MSG_ERROR, true, "Unknown command: %s", cmd);
         return false;
     }