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.