Add mostly functional number formatting. Progress towards #5.

Still behaves oddly when the text field is empty, and when attempting to backspace when the cursor is in front of a formatting character.