Refacted some code to use constants

Specifcally BACKSPACE / ESCAPE / ENTER.
Fixed bug where backspace is not handled correctly in non-canonical
mode.

Fixes #40.
Merge pull request #42 from JacobLeach/terminal

Terminal