TextArea: Refactor OnKeyDown

This function was getting very big. Broke out into helper functions.