first attempt at getting cursor keys working

needs major overhaul to deal with input strings containing newlines,
and the end-of-line cursor-positioning glitch (cursor doesn’t
automatically advance beyond last char on line)