Add macro support.

Replace WGETCH() with input_char(), which works the same except it supports an
input buffer.  Calling input_macro(s) sets the input buffer to 's'.  The input
buffer is returned by input_char() as if it had been typed by the user.

If an error occurs (cmderr()), the input buffer is cleared.
This commit is contained in:
Felicity Tarnell 2014-03-07 23:34:06 +00:00
parent 44b2e4371e
commit 3440a87ea3
9 changed files with 159 additions and 49 deletions

View file

@ -15,6 +15,7 @@
static command_t commands[] = {
{ WIDE("bind"), c_bind },
{ WIDE("macro"), c_macro },
{ WIDE("style"), c_style },
{ WIDE("set"), c_set },
{ }
@ -80,7 +81,20 @@ c_bind(argc, argv)
return;
}
bind_key(argv[1], argv[2]);
bind_key(argv[1], argv[2], 0);
}
void
c_macro(argc, argv)
size_t argc;
WCHAR **argv;
{
if (argc != 3) {
cmderr(WIDE("Usage: macro <key> <def>"));
return;
}
bind_key(argv[1], argv[2], 1);
}
void