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

@ -592,14 +592,20 @@ binding_t *bi;
i = 0;
TTS_TAILQ_FOREACH(bi, &bindings, bi_entries) {
WCHAR s[128];
WCHAR s[128], t[16];
if (bi->bi_key)
SNPRINTF(s, WSIZEOF(s), WIDE("%-10"FMT_L"s %"FMT_L"s (%"FMT_L"s)"),
bi->bi_key->ky_name, bi->bi_func->fn_desc,
bi->bi_func->fn_name);
SNPRINTF(t, WSIZEOF(t), WIDE("%"FMT_L"s"), bi->bi_key->ky_name);
else
SNPRINTF(s, WSIZEOF(s), WIDE("%"FMT_L"c %"FMT_L"s (%"FMT_L"s)"),
bi->bi_code, bi->bi_func->fn_desc, bi->bi_func->fn_name);
SNPRINTF(t, WSIZEOF(t), WIDE("%"FMT_L"c"), bi->bi_code);
if (bi->bi_macro)
SNPRINTF(s, WSIZEOF(s), WIDE("%-10"FMT_L"s execute macro: %"FMT_L"s"),
t, bi->bi_macro);
else
SNPRINTF(s, WSIZEOF(s), WIDE("%-10"FMT_L"s %"FMT_L"s (%"FMT_L"s)"),
t, bi->bi_func->fn_desc, bi->bi_func->fn_name);
help[i] = STRDUP(s);
i++;
}