Beginning of input buffer code, basic scrollback done.